[Python-Dev] [RELEASED] Python 2.7 alpha 2 (original) (raw)

Brett Cannon brett at python.org
Tue Jan 12 19:29:06 CET 2010


On Tue, Jan 12, 2010 at 04:29, Michael Foord <fuzzyman at voidspace.org.uk>wrote:

On 12/01/2010 12:16, Barry Warsaw wrote:

On Jan 11, 2010, at 09:57 PM, Steven Bethard wrote:

Actually there's a solution to this one too: FooBase = Meta('FooBase', (), {}) class Foo(FooBase): ... That should work in Python 2.X and 3.X. Ugly, but good call! :)

There are all sorts of tricks. For example you can do exception handling that works with pre-2.6 syntax and 3.0 with a bare except and using sys.excinfo. It is horrible, but acceptable for short pieces of code (I have a couple of small modules that do this). I haven't yet tried converting larger code-bases to Python 3, but I think the workflow advocated by Martin is greatly preferable to the hacks and tricks needed to make the same codebase run under 2 & 3. In other words we need to pull together a HOWTO for Python source like the one for extension modules that Benjamin wrote and make it rather prominently linked from the Python 3 documentation index page.

-Brett -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20100112/86cc3a21/attachment-0007.htm>



More information about the Python-Dev mailing list