3 ms·
As an end-user, not a python programmer, my problem is that python lacks an idiomatic way to specify which version of python a script should run with. (Or, if i
by parenthephobia 10y ago
As an end-user, not a python programmer, my problem is that python lacks an idiomatic way to specify which version of python a script should run with. (Or, if it does have one, a lot of programs don't bother using it!)
When Arch switched from /usr/bin/python being python 2 to being python 3, buckets of python scripts failed. When downloading third-party python programs, the only way I know to know which version of python to use is to try one and when try the other when it complains about syntax errors.
With a perl-style "use" declaration, the runtime can immediately tell you when you're using the wrong version, or even, in principle, switch to the correct runtime if it's installed.
Hashbangs should refer to a version: e.g. "#!/usr/bin/env python2". Github shows approx. 3M results for "/usr/bin/env python", but less than 200k combined for version-specific hashbangs.
- dom0 10y ago> Hashbangs should refer to a version: e.g. "#!/usr/bin/env python2". Github shows approx. 3M results for "/usr/bin/env python", but less than 200k combined for version-specific hashbangs. For loose scripts this is the way, "env python" is simply wrong. Always use "..env python2" or "..env python3"; it works everywhere, and where the correct version is not installed it gives a relatively helpful error message (something like "No such file or directory: "python2" ").