Implement hashing functions for Command and ServerSession.
This commit is contained in:
parent
ee58e59e7e
commit
f9526e78a8
2 changed files with 22 additions and 0 deletions
|
|
@ -433,6 +433,15 @@ class ServerSession(Session):
|
|||
except AttributeError:
|
||||
return False
|
||||
|
||||
def __hash__(self):
|
||||
"""
|
||||
Python 3 requires that any class which implements __eq__ must also
|
||||
implement __hash__ and that the corresponding hashes for equivalent
|
||||
instances are themselves equivalent.
|
||||
|
||||
"""
|
||||
return hash(self.address)
|
||||
|
||||
def __ne__(self, other):
|
||||
try:
|
||||
return self.address != other.address
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue