7 ms·
Python could very easily have a similar mechanism. Hell even CMake manages to do this right, and they got "if" wrong. The Python devs sometimes seem stubbornly
by IshKebab 3y ago
Python could very easily have a similar mechanism. Hell even CMake manages to do this right, and they got "if" wrong.
The Python devs sometimes seem stubbornly attached to bugs. Another one: to reliably get Python 3 on Linux and Mac you have to run `python3`. But on Windows there's no `python3.exe`.
Will they add one? Hell no. It might confuse people or something.
Except... if you install Python from the Microsoft Store it does have `python3.exe`.
- wrboyce 3y agoI’ve not run “python3” in years on my Mac, and I’m almost certain I never type it into Linux machines either; either I’m losing my mind, or there are some ludicrous takes in this thread.
- rat9988 3y agoYou are surely losing your mind then. Python3 isn't something esoteric.
- wrboyce 3y agoEntirely possible, but my point was I just type “python” and Python 3 happens. Do modern OS even come with Python 2 anymore? I’m not claiming any mystery about Python, just disputing how the modern version is invoked.
- erik_seaberg 3y ago13.5.2 has /usr/bin/python3 (it’s 3.9.6) but not python2 or just python. Not sure when they changed, and YMMV with Homebrew.
- lmm 3y ago> I just type “python” and Python 3 happens. That was the old way. Python now recommends against installing Python3 in a way that does that, and most modern *nix don't.
- jlokier 3y agoJust tried "python" and "python3" on various Linux distros, which output respectively: On an Ubuntu 20.04 desktop VM: python => Python 2.7.18 (default, Jul 1 2022, 12:27:04) python3 => Python 3.8.10 (default, May 26 2023, 14:05:08) On an Ubuntu 19.04 server: python => -bash: python: command not found python3 => Python 3.7.5 (default, Apr 19 2020, 20:18:17) On an Ubuntu 20.10 server: python => -bash: python: command not found python3 => Python 3.8.10 (default, Jun 2 2021, 10:49:15) I no longer have access to some RHEL7 and RHEL8 machines used for work recently, but if I recall correctly they do this by default: Red Hat Enterprise Linux 7: python => Some version of Python 2 python3 => Some version of Python 3 Red Hat Enterprise Linux 8: python => -bash: python: command not found # (use "python2" for Python 2) python3 => Some version of Python 3 You can change the default behaviour of unversioned "python" to version 2 or 3 on all the above systems, I think, so if you're running a Linux distro when "python" gets you Python 3, that configuration might have been done already. MacOS 10.15 (Catalina) does something interesting: python => WARNING: Python 2.7 is not recommended. This version is included in macOS for compatibility with legacy software. Future versions of macOS will not include Python 2.7. Instead, it is recommended that you transition to using 'python3' from within Terminal. Python 2.7.16 (default, Jun 5 2020, 22:59:21) python3 => Python 3.8.2 (default, Jul 14 2020, 05:39:05)
- Liquid_Fire 3y agoTo be fair, few of these would qualify as "modern". Ubuntu 19.04 and 20.10, macOS 10.15 are all out of support, and RHEL 7 is almost ten years old and nearing the end of its support.
- wrboyce 3y agoI suspect my confusion stemmed from mostly invoking `ipython` which doesn't include the 3 suffix (ok, part of the confusion may've been pub-related too :D).
- turboponyy 3y agoDepending on the package manager / distribution, 'python' might be symlinked to either Python 2 or Python 3. If you don't have Python 3 installed, it might very well point to Python 2. These days it will almost certainly prefer Python 3, but I am also in the habit of actually typing 'python3' instead of 'python' because of what I assume are issues I've had in the past.
- beeburrt 3y ago> to reliably get Python 3 on Linux and Mac you have to run `python3`. This is not true on my Fedora 38 system, same with current Kali linux. Although, it is the case with Ubuntu 22.04.3.
- wnoise 3y ago_reliably_, as in on the vast majority of machines.
- billyjmc 3y agoIs that really python’s fault? It seems like it’s the distro making a design decision.
- wnoise 3y agoWell, no, not python's fault -- clearly the distros', and they probably should be blamed. But a PEP saying python2 and python3 should invoke the correct interpreter would help motivate the distributions. (This is isomorphic to the usual victim-blaming discussion. Fault and blame vs some ability to make a difference; it's a shame that correctly pointing out a better strategy is both used to attack victims and attacked for attacking victims in the cases when that wasn't intended.)
- wnoise 3y agoIn fact there is a PEP: https://peps.python.org/pep-0394/ https://peps.python.org/pep-0394/
- IshKebab 3y agoWhat do you mean? Fedora 38 doesn't have `python3`? Are you sure?
- rfoo 3y ago> Except... if you install Python from the Microsoft Store it does have `python3.exe`. It's worse. If you don't install Python from the Microsoft Store there will still be a `python3.exe`. But running it just opens Microsoft Store. Imagine how confused one could be when someone typed `python3 a.py` over a SSH session and nothing happened.