-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"cmp" function should either be documented or removed from the API #117
Comments
Just got burned by this. Was using The current documentation makes it seem like these two functions are the same because of the visual proximity: I haven't looked into the code to tell what the difference between the two are, but perhaps simply removing |
There were two issues: 1. The version was not correctly extracted out of the filename. When extracting a sub-string in Python one has to specify start index and end index instead of start index and length. 2. The function `semver.cmp()` does nothing useful. Instead the function `semver.compare()` must be called when two version should be compared. See python-semver/python-semver#117 (comment) Because `semver.compare()` now really compares the versions it is possible that an exception is thrown if a version is not in the semver version format. In such cases the sorting is aborted and the last filename in the array is returned. This is often but not always already the latest version from what I have seen.
…2490) There were two issues: 1. The version was not correctly extracted out of the filename. When extracting a sub-string in Python one has to specify start index and end index instead of start index and length. 2. The function `semver.cmp()` does nothing useful. Instead the function `semver.compare()` must be called when two version should be compared. See python-semver/python-semver#117 (comment) Because `semver.compare()` now really compares the versions it is possible that an exception is thrown if a version is not in the semver version format. In such cases the sorting is aborted and the last filename in the array is returned. This is often but not always already the latest version from what I have seen.
Thanks @rydrman @doransmestad for the repot and hints. A (limited) docstring is available in master now, see https://github.com/python-semver/python-semver/blob/master/semver.py#L27
Acutally, it's coming from Python2 which has a Currently it acts as a helper function for the |
Yes, I think that is the way to go. I've merged #242 lately which also has an impact on Sphinx. There, I didn't include Use the official section Comparing Versions in our documentation. I think, we can close this issue for the time being. If you still have the feeling there is something missing, reopen it and we can discuss it. Thanks! 👍 |
This function is part of the documentation and public API but is undocumented and looks a little like an alias to
compare
, though it is very much not. I'm simply suggesting that it become_cmp
or get a useful docstring.The text was updated successfully, but these errors were encountered: