This will keep the #!/usr/bin/env python2 in all headers but prepare the syntax for python3. See #7717
Again: This pull will not switch from py2 to py3 nor add full py3 compatibility; it will only make it easier to do either of those later.
This will keep the #!/usr/bin/env python2 in all headers but prepare the syntax for python3. See #7717
Again: This pull will not switch from py2 to py3 nor add full py3 compatibility; it will only make it easier to do either of those later.
If you do this, please also add the appropriate __future__ imports on top of all files for full py2-3 compatiblity (see #7723):
from __future__ import division,print_function,unicode_literals
If you don't, e.g. print("a","b") will suddenly print a tuple on Python 2.x.
I think there seems to be some misunderstanding about this pulls scope: I am not adding support for python3 here. This is just refactoring within python2.
There needs to be another pull which does either of the following:
Yes, but for example, if you replace print a,b with print(a,b) you have to put from __future__ import print_function at the top.
Otherwise this changes the behavior for Python2, which is unacceptable (for now at least).
I don't like the imports considering that they are about to get removed when we switch to py3. Also, I don't see an issue with printing a tuple in the two cases I left. Nonetheless, I changed it to print a string in the most recent commit...
Also, I don't see an issue with printing a tuple in the two cases I left
I just think it's ugly to print a tuple when it's not meant to.
Using python3 print syntax without the appropriate future import is wrong - you don't get the actual functionality, while the developer is deceived into thinking it is - e.g. it also doesn't allow using end='' and file='' for example.
Extended test pass dddd401
I don't like the imports considering that they are about to get removed when we switch to py3
Fine, let's just put off merging this then until we're switching to py3 and dropping py2 support. I'm cannot guarantee that this is going to be soon, though, we haven't had any kind of discussion about doing so.
0 | @@ -1,8 +1,10 @@
1 | #!/usr/bin/env python2
Would speak something against using !/usr/bin/env python here
Let's not change these - I don't think there's a interpreter name that works on all distros and is still general, unfortunately. E.g., Ubuntu 16.04 would require an explicit python2.7 right now(see #7717).
When the QA tests are ported to Python3 we can just make them all python3. That's explicitly not the goal of this pull though.
utACK fa8e2cd
Removed the last commit, rebased, fixed some more bugs: See 7778