Пример #1
0
 def ref(self, key):
     try:
         hash(key)
     except TypeError:
         return self._iddict, Hashable(key)   # key is not hashable
     try:
         weakref.ref(key)
     except TypeError:
         return self._regdict, key            # key cannot be weakly ref'ed
     else:
         return self._weakdict, key           # normal case
Пример #2
0
 def __init__(self, value, concretetype = None):
     Hashable.__init__(self, value)
     if concretetype is not None:
         self.concretetype = concretetype
Пример #3
0
 def __hash__(self):
     return hash((self.__class__, self.type, Hashable(self.instance)))
Пример #4
0
 def __init__(self, value, concretetype=None):
     Hashable.__init__(self, value)
     if concretetype is not None:
         self.concretetype = concretetype