|
|
Subscribe / Log in / New account

Fedora to switch to Python 3 by default

Fedora to switch to Python 3 by default

Posted Oct 24, 2013 17:16 UTC (Thu) by khim (subscriber, #9252)
In reply to: Fedora to switch to Python 3 by default by proski
Parent article: Fedora to switch to Python 3 by default

Then there will be another PEP and, perhaps, another decision.


to post comments

Fedora to switch to Python 3 by default

Posted Oct 24, 2013 18:05 UTC (Thu) by proski (subscriber, #104) [Link] (7 responses)

There should be a standard way for the program to indicate which versions of Python it's supposed to run on, before the whole situation gets too messy. Then the python executable could decide if it's close enough to run the program. A wrapper could be written to select the best python executable for the program.

Fedora to switch to Python 3 by default

Posted Oct 24, 2013 19:20 UTC (Thu) by khim (subscriber, #9252) [Link]

This is probably good idea, but unfortunately it can only help with hypothetical future python3 to python4 transition. Plus it's not clear exactly why it's better to introduce some complex scheme rather then to stick with current “/usr/bin/python is for python2+3 scripts” and “/usr/bin/pythonX is for pythonX scripts (where X ≥ 2)”.

Fedora to switch to Python 3 by default

Posted Oct 24, 2013 19:35 UTC (Thu) by drag (guest, #31333) [Link] (5 responses)

> There should be a standard way for the program to indicate which versions of Python it's supposed to run on

Yes. Here it is:

#! /usr/bin/env python

Indicates the program should use Python 2.7

#! /usr/bin/env python3

Indicates that the program should use Python3.

I don't see why it needs to be any more complicated then that.

Fedora to switch to Python 3 by default

Posted Oct 24, 2013 19:52 UTC (Thu) by proski (subscriber, #104) [Link] (1 responses)

It is more complicated. Some programs support Python 2.4-2.7. Some support Python 2.7-3.3. Some program may support 3.0-3.2 and it's not known if it supports 3.3 because it wasn't tested with it. How would you indicate that?

Fedora to switch to Python 3 by default

Posted Oct 24, 2013 22:29 UTC (Thu) by mgedmin (subscriber, #34497) [Link]

PyPI classifiers:

Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3.2
Programming Language :: Python :: 3.3
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy

Fedora to switch to Python 3 by default

Posted Oct 24, 2013 19:54 UTC (Thu) by khim (subscriber, #9252) [Link] (2 responses)

I don't see why it needs to be any more complicated then that.

Because your non-solution for non-problem breaks killall and does not give you full solution anyway? Some systems out there only have /usr/bin/env and some other only have /bin/env and while these are rare and so can probably be ignored the same can be said about systems where “/usr/bin/env python” exist and is not “/usr/bin/python”.

Frankly I don't see what's this hoopla is all about. Arch made a bad choice and must fix it, end of story. There are nothing to discuss further.

Fedora to switch to Python 3 by default

Posted Oct 25, 2013 19:33 UTC (Fri) by drag (guest, #31333) [Link] (1 responses)

Well besides the fact that I think you missed the point...

Except for system scripts I have found that it's generally not a good idea to specify a absolute path to python for applications and utilities. If somebody has their environment setup so that a different path is used by the python interpreter then it's usually done that way for good reason.

Fedora to switch to Python 3 by default

Posted Oct 25, 2013 22:44 UTC (Fri) by khim (subscriber, #9252) [Link]

Well besides the fact that I think you missed the point...

I think you've missed the point. Your use of /usr/bin/env breaks down in some cases and my use of /usr/bin/python also breaks down in some cases. It means that there are no single “perfect” solution. We much pick one. In my experience killall is valuable and the ability to pick some random version of python is not, your experience may be different, but before we can discuss these experiences we need to find our just why do you need these tricks.

If somebody has their environment setup so that a different path is used by the python interpreter then it's usually done that way for good reason.

My experience is the exact opposite: if one does have /usr/bin/env and a system with shebang support and does not have usable python under /usr/bin/python name then one does something really strange (for example tries to run package which is designed to support modern Linux on some ten-year old Linux) and creates more trouble then it's really worth.

I certainly can not stop such people, but I don't see why their needs and wants must override my needs and wants.

Sometimes one gets the urge to use it to sidestep some other problem using such tricks (for example to sidestep the fact that Mac OS X Leopard uses python 2.5 and not python 2.6), but in such cases usually it's better to just wait and use only python 2.5 features till support of that six years old OS version can be dropped. You can use this trick to do some tricks but two incompatible pythons under the same name eventually lead to problems.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds