[Python-Dev] Core projects: 3to2

Terry Reedy tjreedy at udel.edu
Thu Mar 19 01:04:02 CET 2009


Antoine Pitrou wrote:
> Terry Reedy <tjreedy <at> udel.edu> writes:
>> Or the much requested 3to2 using the same tools.
> 
> I didn't know there was such a request. I thought it was only a PyPy April fool.

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

(in preference to explicit 'if version....') and have .__bool__ be 
either replaced or aliased as .__nonzero__ for a 2.x version.  Answer: 
No.  Use 3to2 if/when available.

This has been the answer in other threads as well.

I believe my own 3.0 code will mainly also need
print() to print statement
except e as a to 2.x version
class C() to class C(object)

An easily doable project would be both used and appreciated.

tjr



More information about the Python-Dev mailing list