6 ms·
Python 2.6 Released
- known 18y agoYou may download Python 2.x and Python 3.0 books at http://www.swaroopch.com/notes/Python http://www.swaroopch.com/notes/Python
- silentbicycle 18y agoAlso, Dive into Python (http://diveintopython.org/ http://diveintopython.org/) is excellent, and the text is free online.
- tjmc 18y agoThis is exactly what I've been looking for. Thank you!
- BrandonM 18y agoI still don't fully understand decorators, but it's definitely true that implementing context managers with decorators is much more succinct and straightforward than manually writing __enter__ and __exit__ methods. And context managers are definitely a win.
- kaens 18y agoAre decorators more than syntactic sugar for functions that take functions?
- irrelative 18y agoDelicious, delicious syntactic sugar :)
- llimllib 18y ago# No. This code: @decorate def foo(self): frobnicate() #is exactly equivalent to: def foo(self): frobnicate() foo = decorate(foo) http://www.python.org/dev/peps/pep-0318/ http://www.python.org/dev/peps/pep-0318/
- gaius 18y agoYeah, but that's really clunky when you want to do @this @that @the_other def foo(self): frobnicate() This is what Java people call "aspect oriented programming" and get all excited about, but to us it's no big deal :-)
- schtog 18y agoUseful example, adding memoization without rewriting the actual function, just add @decoratorname above the function. class memoize: def __init__(self, function): self.function = function self.memoized = {} def __call__(self, *args): try: return self.memoized[args] except KeyError: self.memoized[args] = self.function(*args) return self.memoized[args] @memoize def fib(n)
- anamax 18y ago2.5 supported function decorators, which this is. (The decorator has always been a callable, so the above class has always been legal.) 2.6 supports decorators for other things, including classes.
- illume 18y agoIt drops support for 'older' versions of windows... Including older versions of win2k, winme, win98 etc. They're not only not supporting it, but they've removed code for older versions of windows. So if you want to distribute portable apps, don't use 2.6+
- rbanffy 18y agoBut who in his right mind would recommend people to use Windows versions prior to 2000?
- bayareaguy 18y agoI would, especially for people who use their computers mostly for business. Except for USB and PNP support, Windows 2000 is inferior to NT4SP2. However the Python guys are probably doing the right thing here because the right approach to making windows based business systems reliable is to disable everything possible on them, isolate them as much as you can, get things working and NOT upgrade them unless you absolutely have to.
- briansmith 18y agoRE: "Windows 2000 is inferior to NT4SP2" Windows XP SP2 is basically the minimum version of Windows that you can use and expect a reasonable user experience. That includes the ability to install new (recently released) software. If you insist on old operating systems, then you should expect to run old applicatoins on them.
- nadim 18y agoA good read: http://docs.python.org/whatsnew/2.6.html http://docs.python.org/whatsnew/2.6.html
- illume 18y agoYou'll notice the usual benchmark section is missing from there. The one that tells you python 2.6 is XXX% faster than python2.5 This is because often 2.6 is slower than 2.5. http://mail.python.org/pipermail/python-dev/2008-September/082371.html http://mail.python.org/pipermail/python-dev/2008-September/0... Some things are faster, and some are slower. But for the normal benchmarks mentioned in the release notes (for 2.2, 2.3, 2.4, and 2.5), it's slower overall.
- llimllib 18y ago$ python2.6 /opt/local/lib/python2.5/test/pystone.py Pystone(1.1) time for 50000 passes = 0.867314 This machine benchmarks at 57649.2 pystones/second $ python2.5 /opt/local/lib/python2.5/test/pystone.py Pystone(1.1) time for 50000 passes = 0.970622 This machine benchmarks at 51513.4 pystones/second (which is not to say it's always, or even usually faster; just that it's certainly faster on the standard benchmark)
- illume 18y agoIt also doesn't work on FreeBSD/OpenBSD. Though they plan to fix that at least.
- silentbicycle 18y agoIt looks like it's coming along on OpenBSD: http://www.nabble.com/UPDATE:-python-2.6,-unbreak-python-2.5-td19792541.html http://www.nabble.com/UPDATE:-python-2.6,-unbreak-python-2.5...