I really like your point about how Python should give a better error than a SyntaxError when a Python 2 script is run on a Python 3 interpreter. I agree that the cause of problems should be pointed out clearly to end users. However, I disagree that adding a new file extension is necessary.
On Mon, Feb 04, 2008 at 03:34:56PM -0800, Ralf W. Grosse-Kunstleve wrote: > > If the success of Python is to continue, you have to give your large > user base a clear path to working with two co-existing Python > versions, so that installing a Python 3 application doesn't break all > Python 2 applications (some of which may never be converted since the > original developers have moved on). For example, I really need to be > able to use wxPython based on Python 2 and wxPython based on Python 3 > simultaneously on my Windows machine. I'm thinking this is only > possible if Python 3 uses a new file extension. In Python 2, "import wxPython" will import wxPython based on Python 2, and on Python 3, it will import wxPython based on Python 3. There wouldn't be a Python 2 version of wxPython in the python3.0 site-packages. > Ideally, I'd even want to have both Python 2 and Python 3 scripts in > the same directory, while incrementally converting our applications. > I'd want to cp script.py script.py3, then edit the .py3 version until > it works, while still being able to run the old version during the > migration period. I kind of like the idea of doing the following: import sys major_version = sys.version_info[0] if major_version == 2: import script2 script2.main() elif major_version == 3: import script3 script3.main() It really shouldn't be too bad, I think. -- Andrew McNabb http://www.mcnabbs.org/andrew/ PGP Fingerprint: 8A17 B57C 6879 1863 DE55 8012 AB4D 6098 8826 6868
pgp5nsfw3m8ld.pgp
Description: PGP signature
_______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com