Python 2.5 Released 228
dominator writes "It's been nearly 20 months since the last major release of the Python programming language, and version 2.5 is probably the most significant new release of Python since 2.2. The latest release includes a variety of additions to the standard library, language extensions, and performance optimizations. This is a final release, and should be suitable for production use. Read the release announcement, the highlights, what's new, and download it."
Python Challenge (Score:5, Informative)
I know this is offtopic but does anyone know what happened to the python challenge [pythonchallenge.com]?
There have been no new levels for a long time.
For those who haven't seen it, the python challenge is a great way to learn python.
Sqlite included! (Score:4, Informative)
In keeping with the theme of adding tried and true packages to the standard library, in 2.5 we've added ctypes, ElementTree, hashlib, sqlite3 and wsgiref to the standard library that ships with Python.
That made me sit up and take notice. A pretty nice programming language with built-in functionality to read and write Sqlite databases natively?
Looks like they release a Mac installer, too. Think I'll have to check it out when I get home
Cheers
Re:Languages continue to evolve into ... Lisp (Score:3, Informative)
Lisp isn't used because it wasn't standardized until the late 80's, it uses much more memory than C (though it is almost as fast as C++) and most programmers until recently have learned to program Unix and not Lisp machines. Also, MS doesn't have a lisp implementation so that means that if you don't go to a research university you won't see anything but MS (little podunk colleges are notorious for teaching 'how to program Microsoft'. Any college with a class in Visual Basic should have it's accreditation revoked.)
Finally C gives easy hooks into the OS, which isn't the same at all with Lisp, although you can do anything you can do with C it isn't Lispy to do so.
Finally, C is good enough. If you really want to wonder about languages, ask why Perl is used for anything. Perl sucks.
In line conditionals, FINALLY (Score:4, Informative)
It is good to finally see inline conditions such as:
This just makes me happy!
Re:Languages continue to evolve into ... Lisp (Score:5, Informative)
I think C is too hard for most programmers too. I may be in a bad mood, but I think most programmers do PHP and Visual Basic, badly. They wouldn't grasp Lisp's macros. Of actually good programmers, a very small percentage know Lisp; I wouldn't start a professional project in it for that reason.
I personally love Python (used it for all the code I wrote for my thesis), but these days I program Perl at work. It's not that bad, really. It makes sense, in its own way and it's got a good solid set of libraries available out there. Java isn't half bad for bigger projects either, actually.
About half a year ago, I tried to get into Lisp. It sounds like the holy grail - execution speed and error checking of a compiled language with all the speed of development of more dynamic languages. Perhaps s-expressions should be perfectly suited for HTML too (I'm still stuck in this web app world, at the moment). So I picked up Practical Common Lisp, installed SBCL, joined some mailing lists, found some libraries, got experimenting...
Two things meant I got disinterested in a month or so: it has far too many slightly-differently-named functions in the standard language, many with non-obvious names too (that's what PHP gets its harshest criticism for); and also the huge library of things you need nowadays (internet stuff, databases, OS stuff, etc) is either missing or rather undeveloped.
But it's still promising. I'll probably have another look in a few more months :-)
Re:Too many pirates riding the snake... (Score:3, Informative)
Python is not anything like Lisp (Score:1, Informative)
I think Paul Graham looked at Python 1.0, saw that it had a "lambda" in there somewhere, and had a little orgasm in his pants. Then he wrote an article about it and the Python fanatics didn't realize what he meant was, "compared to C++, COBOL, and FORTRAN, Python is a lot like Lisp". So every now and then, somebody comes along and compares Python to Lisp (favorably or unfavorably).
Python rarely uses "lambda" these days, I think Guido has "deprecated" that kind of usage pattern, and Python doesn't have MACROS, which are kinda what makes Lisp. And of course, no s-expressions (and the whole whitespace thing makes Python even HARDER to parse than other langauges).
Now Ruby has the anonymous function thing ("blocks") which lets you do some of the same things you can do in Lisp with Macros, and Ruby generally "feels" more like Lisp to me (but it's no replacement for Lisp either). And Perl, even though the syntax is awful, is even *more* like Lisp, if you can believe it (you can do "blocks" in Perl as well for instance, though I hardly ever see it, and you can "roll your own" objects as in Lisp).
So please, let's stop pretending that Python is "Lisp" in any way shape size or form.
Re:Woot -- conditional expressions! (Score:5, Informative)
It's not about "too easy", it was rejected after lenghy discussions on python-dev. You can read explanations, modivations, and get links to quite a lot of discussions on the PEP 308 - Conditional Expressions page [python.org].
Whatever your thought on the result is, don't think for a second that the decision of this was easy, or a side-note on a receipt.
Re:try/except/else/finally (Score:5, Informative)
else:
print "no exceptions occured!"
Everything else is the same as Java/C++.
Re:In line conditionals, FINALLY (Score:2, Informative)
print (a==b and ["first option"] or ["second option"])[0]
if they're constant strings, you of course don't need this, but if they're expressions that might evaluate to False, you do need to do this.
For example, if you have a function:
def foo(a, b, x, y):
print a==b and x or y
and you don't know that x will never be False (or 0), then you have to write it as:
def foo(a, b, x, y):
print (a==b and [x] or [y])[0]
The list [x] can never be False, so this always works. Given this subtle error, I much prefer the new syntax.
WxPython (Score:5, Informative)
http://www.wxpython.org/download.php [wxpython.org]
as soon as i'd installed python 2.5 all my app died, took me a few mins
to realise that py2.5 breaks wxpython for py2.4, and some tk demo's ran:)
Re:try/except/else/finally (Score:4, Informative)
The code that you run after the part you may want to protect could thrown an exception that you wouldn't want to catch in your except handlers.
The else clause gives you a way to run it without the risk of shadowing/accidentaly catching these exceptions.
Re:Easy transition from Python to Ruby? (Score:4, Informative)
Re:Easy transition from Python to Ruby? (Score:3, Informative)
Learning Python... add pyrepl to the interpreter. (Score:2, Informative)
Tip #2: Avail yourself of the help() function in the interpreter. help(SomeObjectOrFunction) i.e. help(open) will return the docstrings associated; help(SomeModule) i.e. import sha; help(sha) will return the module docs.
Re:Too many pirates riding the snake... (Score:2, Informative)
Re:Woot -- conditional expressions! (Score:2, Informative)
I don't feel particularly strongly about it, but it seems to me that the Python syntax gets unwieldy more rapidly when you have nested conditionals, like so:
"first option" if a==b else ("second option" if a==c else "third option")...versus...
a==b ? "first option" : (a==c ? "second option" : "third option")My other concern is that it's immediately obvious that a C conditional is just that, but the Python syntax makes it a little obscure:
s = "first option" if a==b else "second option";...versus...
s = (a==b) ? "first option" : "second option";Isn't it a little tempting to read the Python version as s = "first option"? Might be just me, though. My knowledge of Python is somewhere between jack and s**t, so maybe it just makes sense there.
Re:Python is not anything like Lisp (Score:3, Informative)
Duh, looks like you never used macros, blocks don't let you do anything macros let you do, they let you do what lambdas (anonymous functions) let you do in lisp.
These is no relation at all between blocks and macros, macros are tools to generate (transform) code. The only think that could be linked to macros in Ruby are class_eval and instance_eval-type methods.
Now please shut up, you don't even being to grasp what macros are or what they're used for, so don't talk about them.
Re:Use the appropriate language (Score:3, Informative)
Re:try/except/else/finally (Score:2, Informative)
Re:Dive Into Python (Score:4, Informative)
Not that I dislike Jython. Quite the contrary: I use it more than I use cPython, for a variety of reasons. But its development is going slowly enough that it's making me want to brush up on my Java so I could help out.
learning (Score:2, Informative)
Re:Languages continue to evolve into ... Lisp (Score:2, Informative)
1. What is Lisp, and where to find the community web sites
Cliki is a good start:
http://www.cliki.net/index [cliki.net]
2. How to locate, download, and install all the major Lisps on Linux, Mac, and Windows
On Debian: apt-get install sbcl
For windows try Lispbox:
http://www.gigamonkeys.com/lispbox/ [gigamonkeys.com]
3. Basic language grammar, including CLOS
The best text is "Practical Common Lisp":
http://www.gigamonkeys.com/book/ [gigamonkeys.com]
4. How to use ASDF (including complex examples)
5. How to fully interface with the operating system, including implementation-specific functions for file i/o, network i/o, command-line arguments, the environment, threads, and more
6. How to package a standalone Lisp application to deliver to customers
7. How to use UFFI
CFFI seens to be a better option:
http://common-lisp.net/project/cffi/ [common-lisp.net]
With a good manual:
http://common-lisp.net/project/cffi/manual/index.
8. How to set up a Lisp web application server (modlisp or Araneida or
9. How to use the most common libraries: CLSQL, OpenGL, SDL
Common lisp community is growing, and the OS integration, libraries and documention is improving.