Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Programming IT Technology

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. "
This discussion has been archived. No new comments can be posted.

Python 2.4 Final Released

Comments Filter:
  • by Frater 219 ( 1455 ) on Tuesday November 30, 2004 @12:47PM (#10953589) Journal
    The What's New document gives a somewhat inaccurate description of the importance of the Decimal type. Naturally, switching from binary to decimal changes which fractions can be exactly represented, but it does not change the fact that some cannot.

    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)

    by hey ( 83763 ) on Tuesday November 30, 2004 @12:47PM (#10953591) Journal
    Instead of having a special keyword for immutable sets (frozenset) wouldn't it be better to have an "immutable", "final" or "const" keyword?!
  • by mi ( 197448 ) <slashdot-2017q4@virtual-estates.net> on Tuesday November 30, 2004 @12:53PM (#10953653) Homepage Journal
    I do not see "Extensions API" anywhere on the list of improvements. Last I tried, creating one's own object type or even a simple command was a rather tedious task, unlike in TCL...
  • Dive into Python (Score:4, Interesting)

    by cbelle13013 ( 812401 ) on Tuesday November 30, 2004 @12:54PM (#10953657)
    I had absolutely no interest in Python until I read Slashdots review of Dive Into Python [slashdot.org]. Its right on target and got me excited to run home and see what I could do. Of course that only lasted for about a month, but I'll be sure to head home and take a peak at it again.
  • by ultrabot ( 200914 ) on Tuesday November 30, 2004 @12:58PM (#10953697)
    after Linus's comments I am inclined to get more profficient with Bash and C and almost ignore Python completely. It's so dissapointing though - I really wanted to learn Python; it's such a neat language.

    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)

    by Anonymous Coward on Tuesday November 30, 2004 @01:06PM (#10953777)
    Any chance jython may be updated, soon? It seems it is two versions behind?
  • Is it just me? (Score:5, Interesting)

    by digitaltraveller ( 167469 ) on Tuesday November 30, 2004 @01:07PM (#10953799) Homepage
    Or has python strayed from it's original philosophy of 'one best way to do it'?

    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.
  • by BestNicksRTaken ( 582194 ) on Tuesday November 30, 2004 @01:16PM (#10953880)
    Now we just need to wait for 2.4 versions of py2exe, cx_Freeze3, wxPython 2.5.3.1, SPE, IDLE, PyQt, SWIG etc. before we can start using this!

    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)

    by hey ( 83763 ) on Tuesday November 30, 2004 @01:17PM (#10953896) Journal
    Does it use that new Parot thingie that Python and Perl were supposed to share?
  • by pragma_x ( 644215 ) on Tuesday November 30, 2004 @01:43PM (#10954168) Journal
    ...but I am impressed with the whole funciton-decorator addition to the language.

    Function Decorator Proposal/Specification [python.org]

    Its nice to see a language evolve in favor of use without sacrificing readability and overall utility.

    Before:
    def foo(cls):
    pass
    foo = synchronized(lock)(foo)
    foo = classmethod(foo)
    After:
    @classmethod
    @synchronized(lock)
    def foo(cls):
    pass
    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)

    by kraut ( 2788 ) on Tuesday November 30, 2004 @01:48PM (#10954221)
    I refuse to use any language that would take that as code rather than noise.
  • by Frater 219 ( 1455 ) on Tuesday November 30, 2004 @01:48PM (#10954225) Journal
    How do you return an anonymous function from a function in Python?
    You don't use lambda. You define a function (with def) under a temporary name and return it. The temporary name is local to the enclosing function, so it doesn't pollute the namespace: Python def differs in this regard from CL defun.

    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)

    by Defiler ( 1693 ) * on Tuesday November 30, 2004 @02:00PM (#10954341)
    Take a look at this, and the very elegant Scheme dialect that was designed to go along with it.
    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)

    by Pxtl ( 151020 ) on Tuesday November 30, 2004 @02:02PM (#10954378) Homepage
    Wow, generators, decorators.... how much more linguistic cruft is it gonna take before they just give up and implement Ruby style blocks? It seems like 90% of these are created because lamdba sucks and def isn't anonymous.
  • Re:OK Trolls... (Score:3, Interesting)

    by asdfghjklqwertyuiop ( 649296 ) on Tuesday November 30, 2004 @03:06PM (#10955067)

    Example: Say you're debugging a script on an 80 character wide TTY display. Do you really want to go through each line, scrolling all the way to the end because your language has significant whitespace?


    Uh, no, I don't... which is why I'm glad this is perfectly valid python syntax:
    a = [1,2,3,
    4,5,6,
    7,8,9]

    def somefunc(s1,s2,s3):
    print "1 "+s1+"\n"+ \
    "2 "+s2+"\n"+ \
    "3 "+s3+"\n"

    somefunc("as","df",
    "gh")
  • Re:OK Trolls... (Score:4, Interesting)

    by asdfghjklqwertyuiop ( 649296 ) on Tuesday November 30, 2004 @03:39PM (#10955517)

    Say it's someone else's script. You'd have to write another script to process the original script to add the escape characters where they're needed and regular linebreaks where they're not.


    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)).


    And I still think that if there's not a visible character there, it shouldn't mean anything. It goes against logic: Nothing isn't something.


    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.

  • by tungwaiyip ( 608795 ) on Tuesday November 30, 2004 @04:00PM (#10955750) Homepage
    You example is a very powerful one liner!

    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)

    by Anonymous Coward on Tuesday November 30, 2004 @05:30PM (#10956838)
    > Wow, generators, decorators.... how much more linguistic cruft is it gonna take before they just give up and implement Ruby style blocks?

    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 ... of course, having no statements also helps (semicolons in do blocks get turned into >>=\x-> sequences by the compiler)

Any circuit design must contain at least one part which is obsolete, two parts which are unobtainable, and three parts which are still under development.

Working...