> I think the intent of 2to3 is that you maintain the > Python 2.6 version and automatically create the Python 3 version from > it. So there is only one source file. At least one person found this > practical, for a large codebase (well, he says it "mostly works"): > http://wiki.python.org/moin/PortingDjangoTo3k > >> no one has addressed your original >> request directly, so i'll do it here: it is nearly impossible to have >> a sufficiently complex single .py source file that will run under both >> Python 3 and Python 2 -- one single print statement would ruin it, if >> you know what i mean. > > Here are three success stories of creating a single version of a > sizable project that runs in both 2.x and 3.0: > http://pythonology.blogspot.com/2009/02/making-code-run-on-python-20-through-30.html > http://mail.mems-exchange.org/durusmail/qp/441/ and followup > > The postings have a fair amount of detail. Durus, QP, QPy and evoque > are all open source so you can see how they did it. > http://www.mems-exchange.org/software/ - the latest releases include > the Py 3.0 code though the README files don't mention it. > http://evoque.gizmojo.org/
wow, great links Kent. i didn't think that people would be as bold as to do this, but i guess it was inevitable. it's interesting to see both the similarities and the differences for those who are trying to maintain a single version source. (in particular, the "if" statements checking versions with attributes of the sys module reminds me of old C code i worked on years ago when maintaining apps that had to run on both Unix and Windows systems.) it may be worthwhile to collate all of this info into a "2to3 FAQ" at some point. cheers, -- wesley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Python Web Development with Django", Addison Wesley, (c) 2009 http://withdjango.com wesley.j.chun :: wescpy-at-gmail.com python training and technical consulting cyberweb.consulting : silicon valley, ca http://cyberwebconsulting.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor