Software-update: Python 2.4

Zo'n anderhalf jaar, 481 patches en 502 opgeloste bugs na het uitkomen van versie 2.3 is nu de final-versie van Python 2.4 uitgekomen. Python is een programmeertaal waarmee simpele tot complexe platform-onafhankelijke applicaties kunnen worden ontwikkeld. Deze taal wordt door veel bedrijven gebruikt zoals onder andere Industrial Light & Magic, Google en NASA. Voorlopig zijn alleen de broncode voor Unix en MaxOS X uitgebracht en een installer voor Windows. De MacOS X installer is nog niet bijgewerkt. De uitgebreide release notes zijn op deze pagina na te lezen, maar dit zijn de belangrijkste ontwikkelingen:

Faster
  • A number of modules that were added in Python 2.3 (such as sets and heapq) have been recoded in C. In addition, there's been a number of other speedups to the interpreter.
New language features
  • multi-line imports - when using imports in the form from foo import bar, baz, bing, bang, you can surround the imported names with brackets, and they can be split across lines. This is part of PEP 328.
  • Farewell to OverflowWarning - as documented in PEP 237, Python no longer generates OverflowWarnings.
  • function/method decorators - function and method decorators, first described in PEP 318, have been added to the language, using 'pie-decorator' syntax. Decorators are on the line before the 'def', and prefixed with an '@' sign. (PEP 318)
  • Assigning to None - the compiler now treats assigning to None as a SyntaxError.
  • Failed import cleanup - when a module import failed, versions of Python prior to 2.4a2 would leave a broken module in sys.modules - subsequent attempts to import the failing module would silently succeed, but use the broken module object. The import machinery now removes the failing module from sys.modules if the import fails.
  • The -m command line option - python -m modulename will find a module in the standard library, and invoke it. For example, python -m pdb is equivalent to python /usr/lib/python2.4/pdb.py
New or upgraded built-ins
  • built-in sets - the sets module, introduced in 2.3, has now been implemented in C, and the set and frozenset types are available as built-in types (PEP 218)
  • unification of integers and long integers - an operation that would return a number too big for an integer will automatically return a long integer. (PEP 237)
  • generator expressions - generator expressions are similar to a list comprehension, but instead of creating the entire list of results they create a generator that returns the results one by one. This allows for efficient handling of very large lists. (PEP 289)
  • reversed() - a new builtin that takes a sequence and returns an iterator that loops over the elements of the sequence in reverse order (PEP 322)
  • new sort() keyword arguments - sort() now accepts keyword arguments cmp, key and reverse
  • sorted() - a new builtin sorted() acts like an in-place list.sort() but can be used in expressions, as it returns a copy of the sequence, sorted.
  • string methods - strings gained an rsplit() method, and the string methods ljust(), rjust() and center() accept an argument to specify the fill character.
  • eval() now accepts any form of object that acts as a mapping as its argument for locals, rather than only accepting a dictionary. There's all sorts of new and shiny evil possible thanks to this little change.
New or upgraded modules and packages
  • a new subprocess module for spawning processes in a platform-independent way (see PEP 324)
  • decimal - a new numeric type that allows for the accurate representation of floating point numbers (avoiding the problems of binary floating point) (PEP 327)
  • os.urandom() has been added for systems that support a source of random data (entropy)
  • The mpz, rotor and xreadlines modules have been removed.
  • The difflib module now includes an HtmlDiff class that creates an HTML table showing a side by side comparison of two versions of a text.
  • The socket module gained the socketpair() function, on systems that support it.
  • os.path.lexists(), which tests whether the path is a symlink.
  • The doctest module has been massively refactored, with many new features added, and many new hooks for customizing behavior.
  • Non-blocking SSL sockets work again.
  • time.strptime() can now infer the date using %U or %W (week of the year) when the day of the week and year are also specified.
  • The optparse module was updated to Optik 1.5a1.
  • The new module cookielib supports client-side HTTP cookies. urllib2 gained a new class HTTPCookieProcessor that uses this new module.
  • The CJKCodecs collection of East Asian codecs, maintained by Hye-Shik Chang, was integrated into 2.4.
  • The email package's Parser was completely rewritten to better handle malformed email messages. It should now never fail to parse a message and will annotate the parsed message to indicate what problems were found during the parsing. There is also a new FeedParser that allows messages to be fed into the parser as they are read in.
  • The bisect module now has an underlying C implementation for improved performance.
  • There is a new collections module for various specialized collection datatypes. Currently it contains just one type, deque, a double-ended queue that supports efficiently adding and removing elements from either end.
  • The asyncore module's loop() now has a count parameter that lets you perform a limited number of passes through the polling loop. The default is still to loop forever.
  • The curses module now supports the ncurses extension use_default_colors(). On platforms where the terminal supports transparency, this makes it possible to use a transparent background.
  • imaplib now supports the IMAP THREAD command
  • heapq has two new functions nlargest() and nsmallest() to find the N largest or smallest values in a dataset.
  • itertools has a new function groupby() that acts a little like an SQL "GROUP BY" statement. It also gained a function tee() that returns N independent iterators that replicate the iterator passed as an argument.
  • A new function basicConfig() was added to the logging package to simplify setup for logging. There is also a new TimedRotatingLogFileHandler which automatically rotates log files at a fixed interval.
  • The operator module gained functions attrgetter() and itemgetter()
  • The posix module (available as os) has a new function getsid()
  • poplib supports POP over SSL
  • profile can now profile C extension functions
  • random has a new method getrandbits(N) to return a random integer N bits long.
  • The re module was extended to allow simple conditional expressions in regular expressions. In addition, the underlying SRE engine is now non-recursive (previously, certain types of regular expression would run into troubles with recursion).
  • The weakref module now supports a wider variety of Python objects includes Python functions, class instances, sets, frozensets, deques, arrays, files, sockets and regular expression objects. In addition, the weakref type is now a new-style object which can be subclassed.
  • xmlrpclib now supports a multi-call extension for transmitting multiple XML-RPC calls in a single HTTP operation.
  • The base64 module now supports Base64, Base32 and Base16 encoding and decoding, and more complete support for RFC 3548.
Versienummer 2.4
Besturingssystemen Windows NT, Windows 2000, Linux, Windows XP, Linux x86, Windows Server 2003
Website Python
Download http://www.python.org/download/
Licentietype Voorwaarden (GNU/BSD/etc.)

Door Bart van Klaveren

Downloads en Best Buy Guide

02-12-2004 • 15:13

16

Submitter: Anoniem: 26202

Bron: Python

Reacties (16)

16
16
9
0
0
6
Wijzig sortering
Hmmm zouden er veel gebruikers van dat spul op Tweakers rondlopen? Waag 't te betwijfelen ;)
In elk geval zullen de gebruikers van Active Spam Killer en Spamassassin het wel gebruiken lijkt me.
Die zijn in Python geschreven.
Spamassassinm, is in perl geschreven
Die andere ken ik niet, mischien nog eens handig... eens kijken of het wat is :-)
Hij bedoelde misschien SpamBayes, wat wel in Python geschreven is.
Yep, hier is er eentje. Prachtig taaltje, beetje Perl achtig. Google gebruikt 't geloof ik ook.
[edit]
tja, ik weet zeker dat Google het gebruikt, want dat staat nou eenmaal in het artikel hierboven. |:(
[\edit]
Gebruikers? Ja. Vele bittorrent clients zijn er namelijk in geprogrammeerd. En god knows dat veel tweakers bittorrent gebruiken.

Of er ook veel tweakers in coden? Hmm misschien relatief gezien aan (delphi)pascal, java, c++ etc niet, maar het is absoluut geen klein taaltje.
Anoniem: 61307 @EraZor2 december 2004 17:21
Echt een geniale taal. Oorspronkelijk ben ik een die-hard C en een beetje C++ hacker, maar python is het helemaal.
Programmeren is *echt* leuk en efficient met deze taal. Ben helemaal afgestapt van C++ en Java.
Anoniem: 82930 @EraZor2 december 2004 16:27
Hmm, meer dan je denkt IMO. Python is niet zomaar een taaltje dat maar weinig voorstelt.
Bovendien is het vooral onder Linux veel gebruikt voor "standaard" software, waaronder up2date van Red Hat / Fedora Core.
Wat dacht je van gentoo daar is het hele emerge/portage systeem opgebaseerd echt onmisbaar bij gentoo-linux.
Python is de taal die gebruikt wordt bij de scripts van media center voor de Xbox. Wie heeft er tegenwoordig geen xbox? De scripts zijn echt geweldig, van online tvgidsen kijken tot galgje spelen of je e-mail ophalen via de xbox. Ik ben ook benieuwd of er kant-en-klare tutorials beschikbaar zijn.

:9~
hier een Python open source boek (erg goed)
http://www.diveintopython.org/
(op pagina staan ook veel links)

Verder hier Python info van IBM:
http://www-128.ibm.com/developerworks/search/searchResults.jsp?searchT ype=1&searchSite=dW&searchScope=dW&query=python&Search.x=0&Search.y=0& Search=Search

Ook interressant: onlamp (van O'reilly)
(LAMP staat voor: Linux-Apache-Mysql-Python/Perl/Php)
http://www.onlamp.com/python/

Voor de toekomst: Python/Perl krijgen, naar het schijnt, een belangrijke rol toegewezen in grid computing.
http://www-128.ibm.com/developerworks/grid/newto/index.html
en
(LAMP Grid Application Server, No More J2EE)
http://linux.slashdot.org/article.pl?sid=04/11/22/0518256

Hier nog het dagelijkse Python news:
http://www.pythonware.com/daily/
Meer dan 100 Python tutorials:
http://www.awaretek.com/tutorials.html

:)
Weet iemand toevallig waar je een tutorial vind om grafische applicaties te schrijven in python?
leuk nieuwe versie. Heb het een tijdje op mijn pc geinstalleerd gehad maar het is me nog niet duidelijk ( als iwndows user) hoe nu te proggen in deze taal. (ja * 786562 Da

Op dit item kan niet meer gereageerd worden.