[Python-Dev] [RELEASED] Python 2.7 alpha 2

Michael Foord fuzzyman at voidspace.org.uk
Tue Jan 12 13:29:12 CET 2010

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.


>> I've got argparse running on Python 2.3-3.1, and the changes were
>> pretty easy. You can see them all in the revision here:
>>     http://code.google.com/p/argparse/source/detail?r=12
>> I have aspirations of putting all of the tricks I learned up up on the
>> Wiki somewhere, but I just haven't had the time.
> The more resources we can provide people, both in code and in documentation,
> the better.
> Thanks!
> -Barry
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk


READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.

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

More information about the Python-Dev mailing list