According to Distrowatch, out of the top twelve (12) distros, all but #8--Arch--use Python2.
The other 11 in order of popularity are #1 Mint, #2 Ubuntu, #3 Debian, #4 Mageia, #5 Fedora, #6 openSUSE, #7 elementary OS, #9 Zorin OS, #10 Puppy Linux, #11 PCLinuxOS, and #12 CentOS.
That's not quite a complete picture. Those distros include Python 2 as the default "python" executable, but many include Python 3 as python3, and even more have standard python3 packages that just aren't installed by default.
At work, I am writing tools in Python 2.6.6 specifically because the latest version of RHEL comes with only that, and I cannot get aftermarket versions of tools onto our servers. Is that the fault of Python? No, but I'm sure I'm not the only person working at a stuffy organization with crappy open source policy.
So do I (in some cases even stuck on Python 2.4) [RHEL 5]. But at the same time (re: Python 2.6) I never really thought "oh I really need the latest 3.4 or my project will fail". It doesn't offer dramatic speed improvement, concurrency, some nice built-in web framework or anything.
I would take 3.4 if someone else spent the time testing and validating my code against but I just don't have the time to invest because I just don't see an upside to it at the moment.
Why are you assuming the worst possible intent on my part, instead of asking what I meant?
I meant the distros have Python 3 available, not that they make it the default that /usr/bin/python points to. Ubuntu has had Python 3 available for quite a number of releases; I run 12.04 which has Python 3.2 (and I've had it installed since I installed Ubuntu). According to the release notes[1], Ubuntu 14.04 makes Python 3.4 available, and work is ongoing to make it the default Python for Ubuntu. They also advise porting to Python 3.
It looks like CentOS makes Python 3.2 available, but I can't be sure from their online documentation.
But I also didn't say you are spreading lies maliciously. You can spread them unknowingly via mis-communication.
I could post something like "Large parts of the Linux kernel are written in C++". And it would be spreading lies. But it could be just be me being confused as well or thinking that a C++ compiler will compile C and that C is a largely a subset of C++.
> I also didn't say you are spreading lies maliciously
My objection wasn't that you imputed malice; it was that you went straight to "spreading lies" instead of expressing uncertainty about what I meant. And you were wrong about what I meant.
> You can spread them unknowingly via mis-communication.
Which, since you were wrong about what I meant, is what you did when you said I was "spreading lies".
Many distros include both Python 2 and Python 3 support. I think pdonis is saying that distros that support Python 3 are not stuck on 3.0. That is, their Python 3 packages are 3.2 or higher, so comparing 2.7 to 3.0 is unreasonable, since it's not a choice anyone has to make. Which seems to be true. For example, the relatively conservative Debian is currently on Python 3.2, with Python 3.3 in the next version. Ubuntu's python3 is currently 3.4. Fedora appears to be 3.2. Arch has Python 3.4, I think.
So what pdonis was saying is, as far as I can tell, true.
The post I was responding to talked about books on Python for students, presumably students studying programming. Python 3 doesn't need to be the default python for students studying programming to use it; it just needs to be available. If the post had been talking about, say, sysadmins, that would be a different story.
I think it's recommended for distros to modify the shebang to /usr/bin/env python3 for script that are supposed to run under python 3, although this does pose a problem for scripts that want to run under both without modification. If the distro ships with python3 and most of the system scripts run under python3 I'd say its the default.Ubuntu for one is planning on not shipping a python2 or /usr/bin/python binary by default(although it will still be in repos) eventually.
Any script worth it's salt that depends on a newer feature of Python 3 can just check `sys.version_info`. This was a thing one had to consider back when new versions of Python 2.x were coming out, too.
It's not quite that simple. Not all code that runs on Python 2 will be syntax-compatible with Python 3, and vice versa. You can, with some effort, use a subset of the Python syntax that is compatible with both interpreters, but many libraries do not do that, but ship separate Python 2 and Python 3 versions if they support both.
Syntax changes can be an issue for backwards compatibility, but that's not what I was talking about.
It's easy to specify what the minimum version of Python you want to support is. Even if there's syntax which is incompatible with Python 2 in the file, a hashbang that specifies `python3` is pretty clear.
Yes, #!/usr/bin/python3 is clear, but I don't think it addresses the question you were responding to, which was whether the scripts the OP of this subthread was talking about, which he knows will run under Python 2 (because he downloaded them and ran them under Python 2--he mentioned this in another subthread), will know to check for the presence of Python 3 and use it. Any such script will have to check sys.version_info to know which version of Python it is running under (and for at least one version the shebang will be irrelevant anyway since it can only specify python or python3, not both), and it will have to be syntax-compatible with both versions. If the script isn't syntax-compatible with Python 3, then he'll have to go find and download a version that is, if it exists.
Maybe you need to read more up to date books. The latest release is Python 3.4, and even most Linux distros are at least at Python 3.2.