Skip to content

Commit

Permalink
PackageRecord: cache __hash__ value
Browse files Browse the repository at this point in the history
  • Loading branch information
mbargull committed Aug 30, 2018
1 parent 9204b42 commit efc7745
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion conda/models/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ def _pkey(self):
return __pkey

def __hash__(self):
return hash(self._pkey)
try:
return self._hash
except AttributeError:
self._hash = hash(self._pkey)
return self._hash

def __eq__(self, other):
return self._pkey == other._pkey
Expand Down

0 comments on commit efc7745

Please sign in to comment.