On Thu, Dec 15, 2011 at 9:51 AM, Alex Bolgarov <alex@bolgarov.org> wrote:
you all think the proper fix is for me to put in the docs something like "on Arch systems you need to do [x] before building", whether [x] is "get the PKGBUILD with the patch from AUR" or even "run the sed-python-with-python2.sh included in the distribution".
I personally don't think it is a proper fix - I think it is not a fix at all. My opinion is that Python3 is sufficiently different from Python2 to be considered a new language, not just a new version of old (thus it would be appropriate to use new name, 'python3', for it, leaving 'python' forever referring to python2). (That is, desire to be on the bleeding edge does not warrant breaking existing software)
http://mail.python.org/pipermail/python-dev/2011-March/108562.html ... the thread starts here: http://mail.python.org/pipermail/python-dev/2011-March/108491.html ... if it hasn't been linked already. that discussion led to the aforementioned PEP, and was generally well-received (hence creation of the PEP).
If I were you, I would probably stop putting shebangs into my Python scripts (so that they would be not executables), and write a shell wrapper script for every python script that figures out during runtime how python2 executable is called, and call python2 script using this python executables (or write single script with symbolic links to it with different names and use $0 shell variable to find which python script to call).
you can factor out pieces into separate files and selectively import based on various criteria, like any other module. create an small bootstrap file that is python2/3 compatible and either run/import according to the binary you're running under, or re-exec under a different one (slightly rude form a user's perspective, but possible). a little funky, but you can test syntax using eval: http://stackoverflow.com/questions/446052/python-best-way-to-check-for-pytho... ... and catch SyntaxError. per: http://mail.python.org/pipermail/python-dev/2011-March/108495.html http://mail.python.org/pipermail/python-dev/2011-March/108499.html ... not sure if that's changed, but Arch isn't alone ... there was an incubation period of a couple years, until 3.2 release, for applications/libraries to catch up. python3 is here now, so let's give her a big welcome, and move on ;-) -- C Anthony