samuela
September 4, 2021, 10:49pm
1
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.
What is 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.
1 Like
It’s apparently defined here (came up on a google search). It’s defined as :
let
isPy3k = substring 0 1 pythonVersion == "3";
which just checks whether the first character (major value) in the pythonVersion
string is “3” as you assumed.
1 Like
samuela
September 4, 2021, 11:41pm
3
Is there any word on whether we should prefer isPy3k
vs python.isPy3
?
abathur
September 4, 2021, 11:53pm
4
$ 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";
https://github.com/NixOS/nixpkgs/blob/be8323ecb7fabeccf97c37cc1a26b8e413d04555/pkgs/development/interpreters/python/default.nix#L90-L100
2 Likes
samuela
September 5, 2021, 6:17pm
5
I think this is the correct definition. The one in the pypy package appears to just be a local variable.
FRidh
September 5, 2021, 6:31pm
6
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).
3 Likes
rnhmjoj
September 6, 2021, 10:52am
7
Btw, if you’re confused by the “3k”: a long ago Python 3 was sometimes referred to as Python 3000, hence Python 3k.
3 Likes