>> Also, I would replace >> >> "in practice it’s very hard to create programs" >> >> with >> >> "in practice it’s very hard to create complex programs" >> >> because for small programs it's very possible to write code that will >> work with both python 2 and 3. The question is of course what program >> is simple/small and what program is large/complex, but without >> qualifications your sentence is misleading, I think. > > We had the example of Cheetah over in the other thread. Would you say that > Cheetah doesn't qualify as "complex" program?
One code base of cheetah works under python 2 and 3? I doubt it, but I could be wrong. What I can easily imagine is that somebody ported cheetah to python 3. In this case there are two code bases, one for python 2 and another for python 3. So it's not the same program that runs under python 2 and 3. What the sentence in Alf's book is about is having the same code base working for both python 2 and 3. > There are also other > examples, like Django. Again, django has been ported to python 3, that's fine, everybody acknowledges that, but it's not the case that one code base works with both python versions. > Often enough it's just a couple of cleanups and tiny > try-except blocks in the program header that enables running the program in > both Py2 and Py3. Yes, this is true. But I'd say it's fair to say that with complex programs this is usually not the case, but I definitely not want to enter into a discussion into whether any given program is complex or simple. It's a matter of judgement and gut feeling it's pointless to argue about this too much. > If it's more, it can usually be done using 2to3. Again, 2to3 helps with porting, but does not help with having a single code base that will run unmodified on python 2 and 3, which is what Alf was writing about. > So I > would change the above statement into something more like "for some > programs, especially large existing code bases, it can be hard to get the > code to work in both Python 2 and Python 3". I actually agree with this sentence :) > Nevertheless, it has been done, more than once. Example? Just to be clear I'm looking for an example where one given code runs on python 2 and 3 unmodified. I think django and cheetah doesn't count because they simply take their python 2 code, run it through 2to3 which gives them a python 3 code (I could be wrong though). Two codes for the two python versions. > Personally, I don't see much value in deliberately trying to keep people > from porting their code to Py3 by producing underqualified statements like > the above. Nobody is deliberately trying to keep people from porting! I think you misunderstand what is being said, these two statements are very different: (1) single code base working on both python versions (2) creating a second code from a code so that the second code works with python 3 and the first one with python 2. Statement (2) is about porting, statement (1) is about something else. Having said all that I actually seriously doubt (probably in agreement with you) that Alf is able to write good and helpful material on the relationship between python 2 and 3, porting, migrating, etc, based on his emails :) Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list