Public bug reported:
Binary package hint: python-debian
The debian_bundle.changelog.Version class implements __eq__ but not
__hash__
As such, you can almost-but-not-quite use them as dict entries. Consider
v1 = Version('1.1.1-2')
v2 = Version('1.1.1-2')
assert v1 == v2
d = {v1: 'content'}
assert d[v1] == 'content' # True
assert d[v2] == 'content' # False
The reason is that Version uses the default id(obj) as the hash key.
I think a reasonable implementation would be:
def __hash__(self):
return hash(self.full_version)
Assuming that if self.full_version == other.full_version than self ==
other.
** Affects: python-debian (Ubuntu)
Importance: Undecided
Status: New
--
Version does not implement __hash__
https://bugs.launchpad.net/bugs/516783
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs