python-dev

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [Python-Dev] Core projects: 3to2 Antoine Pitrou Wed Mar 18 18:00:26 2009

Terry Reedy <tjreedy <at> udel.edu> writes:
> 
> Some of the people who need to support both late 2.x and 3.x would 
> prefer to write 3.x code and backport.  The OP of a current python-list 
> thread asked whether there was any way to write something like
> 
>       @alias('__nonzero__')
>       def __bool__(self): return True

How about simply:
    __nonzero__ = __bool__

> I believe my own 3.0 code will mainly also need
> print() to print statement

If this is only about supporting "late 2.x" (i.e., 2.6 and upwards), you can
already write:

from __future__ import print_function

> except e as a to 2.x version

Works in 2.6.

> class C() to class C(object)

__metaclass__ = type

Now I'm not saying that all 3.0 code will work in 2.6 with such simple
precautions, far from it!

Regards

Antoine.


_______________________________________________
Python-Dev mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/alexiscircle%40gmail.com