Skip to content
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

VersionInfo string representation #72

Closed
smarie opened this issue Mar 8, 2018 · 1 comment
Closed

VersionInfo string representation #72

smarie opened this issue Mar 8, 2018 · 1 comment

Comments

@smarie
Copy link

smarie commented Mar 8, 2018

It seems that the string representation is not available from VersionInfo. It should be quite straightforward to do with a custom string representation method:

def __str__(self) -> str:
    return (str(version.major) or '') \
           + (('.' + str(version.minor)) if version.minor is not None else '') \
           + (('.' + str(version.patch)) if version.patch is not None else '') \
           + (('-' + str(version.prerelease)) if version.prerelease is not None else '') \
           + (('+' + str(version.build)) if version.build is not None else '')

Note that we can keep __repr__ untouched so that it provides unambiguous representation.

@smarie smarie changed the title Getter for the original string in VersionInfo VersionInfo string representation Mar 8, 2018
@scls19fr
Copy link
Member

__hash__ should also be implemented #73 (probably with a similar method)

scls19fr added a commit that referenced this issue May 15, 2018
* Implements __str__ and __hash__
Closes #72, #73
Should help #74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants