Closed Carreau closed 1 year ago
True, very good point. The only reason it's that way is because I did it like that 4 years ago without questioning: https://github.com/prompt-toolkit/python-prompt-toolkit/commit/64e4b6039ca6aa80fe4825ff188e1932801a79a5
It definitely should be a tuple/list of integers.
I wonder whether something could break by turning this into a list of ints, but if the only thing people are doing is comparisons then probably fixing this is fine.
My main concern would be blind mapping to ints, if something like linux packaging patch it to add things like buildN
, or postN
or whatever suffix they add when they do local modification.
Python 3 also fail with TypeError: '<' not supported between instances of 'int' and 'str'
if anybody tried to compared with string, so if someone actually have a lexicographic version check it may fail.
Usually this is my I prefer to create VERSION manually and str-join the version.
pep 440 is also bit annoying on where to put dots, like a,b,rc dont' have dots, but .dev .post are supposed to have dots.
I can try to whip up a PR, and if you wish add pep440 regex to make sure the str is valid.
Yeah, feel free to create an MR ;)
AFACT it is a foot-gun as the tuple will be compared lexicographically (is
'36' < '4'
) is true.I can imagine there might be legitimate reasons, but I could't find any looking a the codebase.