I’ve been searching everywhere for docs to describe the
isPy3k value. I’m assuming that it tests whether python is version 3.x.x, but I haven’t been able to find any spec for it after quite a bit of googling.
isPy3k exactly? Can we get some docs for it written down somewhere? It seems odd that much of the python ecosystem relies on it without any official word on what it’s spec’d to be.
It’s apparently defined here (came up on a google search). It’s defined as :
isPy3k = substring 0 1 pythonVersion == "3";
which just checks whether the first character (major value) in the
pythonVersion string is “3” as you assumed.
Is there any word on whether we should prefer
$ git grep -n "isPy3k ="
pkgs/development/interpreters/python/default.nix:99: isPy3k = isPy3;
pkgs/development/interpreters/python/pypy/default.nix:25: isPy3k = substring 0 1 pythonVersion == "3";
pkgs/development/interpreters/python/pypy/prebuilt.nix:29: isPy3k = majorVersion == "3";
I think this is the correct definition. The one in the pypy package appears to just be a local variable.
Also worth noting is that
pythonVersion corresponds to the version of the language, which is not per se that of the interpreter (such as with PyPy).
Btw, if you’re confused by the “3k”: a long ago Python 3 was sometimes referred to as Python 3000, hence Python 3k.