[Checkins] SVN: Sandbox/faassen/iface/src/iface/mapping.py A few tweaks to do things in the initialization phase already.
Martijn Faassen
faassen at startifact.com
Wed Jan 6 16:38:50 EST 2010
Log message for revision 107753:
A few tweaks to do things in the initialization phase already.
Changed:
U Sandbox/faassen/iface/src/iface/mapping.py
-=-
Modified: Sandbox/faassen/iface/src/iface/mapping.py
===================================================================
--- Sandbox/faassen/iface/src/iface/mapping.py 2010-01-06 21:32:10 UTC (rev 107752)
+++ Sandbox/faassen/iface/src/iface/mapping.py 2010-01-06 21:38:49 UTC (rev 107753)
@@ -9,9 +9,10 @@
tuple(parent._mro_helper for
parent in parents),
{'mapkey': self})
- # we then store the mro without the last entry, which is
- # always object
- self._mro = self._mro_helper.__mro__[:-1]
+ # we then store the map keys for the mro (without the last
+ # entry, which is always object)
+ self._parent_mapkeys = [
+ base.mapkey for base in self._mro_helper.__mro__[:-1]]
def __hash__(self):
return hash(self.key)
@@ -21,11 +22,9 @@
class Map(dict):
def __getitem__(self, key):
- for base in key._mro:
- if base is object:
- break
+ for mapkey in key._parent_mapkeys:
try:
- return super(Map, self).__getitem__(base.mapkey)
+ return super(Map, self).__getitem__(mapkey)
except KeyError:
pass
raise KeyError(key)
More information about the checkins
mailing list