4 ms·
Nothing got better with Python 3? What about the print function and true division? Sure, those are both there as from __future__ import's, but I'd definitely ca
by rflrob 14y ago
Nothing got better with Python 3? What about the print function and true division? Sure, those are both there as from __future__ import's, but I'd definitely call those improvements.
I haven't switched to Py3k yet either, but I'm just waiting for a few more packages I use heavily to get the bugs worked out.
- archangel_one 14y agoAlso, dict comprehensions. You can fake them in 2.x, but the syntax is ugly and cumbersome.
- masklinn 14y agodict comprehensions were backported to 2.7 $ python2.7 Python 2.7.3 (default, Apr 13 2012, 13:51:30) >>> {i: i+1 for i in range(5)} {0: 1, 1: 2, 2: 3, 3: 4, 4: 5}
- masklinn 14y ago> What about the print function and true division? Those are actually fairly minor in the grand scheme of things (and compound `with` statements have been backported to 2.7). More interesting are: 3.0 * unicode strings by default and much better overall support of unicode * chained exceptions (I don't believe they've been backported) 3.2 * argparse merged to the stdlib * ElementTree 1.3 finalized in stdlib (3.2) * functools.lru_cache, itertools.accumulate (nothing game-changing, but nice to have in the stdlib) * threading.Barrier * concrete tzinfo implementation (for fixed UTC offsets) * contextlib.ContextDecorator (creates a type which works both as a contextmanager and a function decorator), and improved contextmanager support across the board (ftplib, popen, TarFile, ...) 3.3 (soon to be released) * Virtual environments shipped by default * Namespace packages * Kind-of obscure, but flexible string representations (strings can dynamically and transparently switch their implementation between latin-1, ucs-2 and ucs-4, this kills the narrow/wide compile-flag shit and generally makes strings more space-efficient) * sub-generator delegation, instead of: for item in sub_generator_function(): yield item you can just write: yield from sub_generator_function(). it also correctly forwards sent and thrown values (generator.send() and generator.throw()) to the sub-generator, so it actually translates into an unholy mess which now just works and allows more easily splitting a large function into sub-iterators. * lzma/xz support (7z) I'm actually excited for 3.3, there's plenty of cool stuff in there.