Python 2.4 Final Released 359
Eventh writes "The final release of Python 2.4 was just released. Python 2.4 is the result of almost 18 month's worth of work on top of Python 2.3. New features are, but not limited to, function decorators, generator expressions, a number of new module and more. Check out Andrew Kuchling's What's New In Python for a detailed view of some of the new features of Python 2.4. "
On Decimal and floating point (Score:5, Interesting)
The importance of decimal arithmetic is not that it is more accurate than binary, but rather that it conforms more closely to what people expect from using decimal in daily life. These expectations are codified into various social rules such as accounting practices.
There's been some heated discussion of Python 2.4's Decimal, in this very regard, on the Lambda the Ultimate [lambda-the-ultimate.org] languages blog.
frozenset (Score:5, Interesting)
Writing extensions... (Score:3, Interesting)
Dive into Python (Score:4, Interesting)
Re:I *want* to be enthused, but... (Score:5, Interesting)
Linus explicitly mentioned that he doesn't do anything "in the middle" - it's either kernel hacking or something trivial enough to do with bash. Just go ahead and learn Python - you will find that it's *easier* than bash, especially if your programs might have errors (which they do).
BTW, why would you want to get more proficient in C? Programmers are abandoning C in droves. It's just not programmer-time efficient to do things in C anymore. It's one thing if you are maintaining a project that was written in C originally, but for new projects, C is a non-starter.
Go read ESR's "The Art of Unix Programming", available online for free.
jython? (Score:1, Interesting)
Is it just me? (Score:5, Interesting)
I used python in the 1.5 days. The syntax was incredibly clean. Nowadays the language has tremendous idiomatic power, any programming language researcher should be familiar with it.
But that power has brough alot of complexity. At the end of the day, languages are tools and the learning curve to understand (particularly others) python code seems to be increasing.
Supporting software in 2.4 format? (Score:2, Interesting)
I expect some software will even die now - like McMillan Installer, as development stopped on 2.3, unless 2.4-devel has some excellent backwards compatibility with 2.3 libraries.
I'm sticking to 2.3.4 for a good while yet, don't have a use for decorators.....
lazy question (Score:3, Interesting)
Not a Python Programmer... (Score:5, Interesting)
Function Decorator Proposal/Specification [python.org]
Its nice to see a language evolve in favor of use without sacrificing readability and overall utility.
Before: After: Readable is of course in the eye of the beholder... and I am a C and Java programmer with a sizable fetish for D [digitalmars.com]. So while I don't find the syntax all that pleasing to me in terms of my own work, it certainly changes things for reading python code.
I was also stunned to learn how flexible decorators were in the previous version of python. It's refreshing to be see functions treated as objects... unless I'm mistaken about the concept.
However its a huge shame that the new decorator syntax isn't supported for classes in 2.4. Seems like that's going to become a wart on a rather consistent language syntax, IMO.
Re:Pah (Score:3, Interesting)
Re:CommonLisp for the 21st century?! (Score:4, Interesting)
But seriously, Common Lisp is the Common Lisp for the 21st century. It's doing quite nicely; in the past couple of years folks have taken this "old" programming language and added excellent support for all kinds of current needs -- a Web application server (TBNL), a remarkable SQL interface (CL-SQL), general-purpose dataflow programming (Kenny Tilton's Cells), PDF typesetting and generation (CL-PDF, a rival to TeX!), OpenGL ....
(Peter Seibel's Practical Common Lisp [gigamonkeys.com] is highly recommended for the "modern" programmer interested in this "old" language. Practical examples include spam filtering, an MP3 database, and a Shoutcast server.)
Re:Is it just me? (Score:4, Interesting)
How To Design Programs [htdp.org]
One semi-unique feature is that it asks you what your skill level is when you launch the environment, and tailors the feature-set accordingly.
Novices see a simple subset of the language, and experts get the full power inherent in a real-deal Lisp dialect.
Re:genexps (Score:3, Interesting)
Re:OK Trolls... (Score:3, Interesting)
Uh, no, I don't... which is why I'm glad this is perfectly valid python syntax:
Re:OK Trolls... (Score:4, Interesting)
Someone else's script? Written in what, python? Well then I don't need to process anything. It is either valid python or not. If you're just talking about including some pre-formatted text into a python script, then just enclose it in a multi-line string (which in python are inclosed by """ (three double quotes in a row)).
I used to believe python's whitepsace-sensitive C syntax would really get on my nerves if I ever tried python, since I'm used to C and perl. Like many people, I wouldn't even give python a shot because of that whitespace issue. But one day I did because I needed to help a friend, and I actually found the language quite pleasant.
The whitepsace sensitivity didn't get in my way like I thought it would (which is to say it never got in my way, I didn't even notice it). Python's rules for whitespace are quite logical and intuitive and follow the way you're already used to indenting for readability in C or perl. When I started using python, I didn't even have to learn how the whitespace worked like I would have to learn any other syntax. The whitespace rules already worked the way I always programmed, so once I started python I had no trouble at all.
You need to learn the language before complaining (Score:3, Interesting)
You need to learn a few Python idioms. Anyone who work with Python for a while should have no problem understanding this.
1. x and y or z is Python's version of ternary operator. If is similar to x ? y : z in C.
2. " ".join(list) is similar to string.join(" ", list). I won't go into detail here but your expresion collapse a string with multiple whitespaces into single space.
3. The lambda construct is a function factory. Thing of callback in C but Python allow for much more elegant functional style programming.
The entire expression create a function which can collapse or not collapse a string base on you choice. The best thing is to see it in action with two more lines:
for line in file('xyz.txt'):
print processFunc(line)
This will output a files with whitespace collapsed or unmodified depends on the collapse flag.
Every language has its syntax and idiom to learn. Is the syntax below readable? Yes if you actual know the language.
for (i=0; in; i++) {
If you expect 0 learning and that each line of Python maps to something you are familiar with such as C, that's not what Python really is.
Re:genexps (Score:1, Interesting)
Maybe when ruby gets list comprehensions? yes, python's lambda sucks. Even Guido thinks so. Basically, python backed itself into a corner with its whitespace, which is what keeps it from effectively having blocks: the formatting would be brutally nasty, something like using Haskell's layout rule in the middle of a non-layout-rule section. Haskell doesn't have this problem because it *has* optional delimiters and brackets