Extending the dict class
Fredrik Lundh
fredrik at pythonware.com
Tue Aug 29 08:53:05 EDT 2006
"chosechu" wrote:
> Yes, if I could simply modify myfunc() I would have workarounds.
> This would mean me modifying SOAPpy and specializing it for
> my needs.
maybe you could fake it:
class fakedict(dict):
def __init__(self, *data):
self.data = list(data)
for k, v in data:
self[k] = v
def items(self):
return self.data
d = fakedict(("a", 1), ("b", 2), ("c", 3))
print d => {'a': 1, 'c': 3, 'b': 2}
print d.items() => [('a', 1), ('b', 2), ('c', 3)]
print isinstance(d, dict) => True
(the exact set of methods you need to override depends on how SOAPpy
fetches the members).
</F>
More information about the Python-list
mailing list