On Tue, Jan 12, 2010 at 04:29, Michael Foord <fuzzy...@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.exc_info. 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
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com