Re: [Python-Dev] inconsistency when swapping obj.__dict__ with a dict-like object...

2005-04-06 Thread Nick Coghlan
P.S. (IMHO) the type check here is not that necessary (at least in its current state), as what we need to assert is not the relation to the dict class but the support of the mapping protocol The type-check is basically correct - as you have discovered, type & object use the PyDict_* API intern

Re: [Python-Dev] inconsistency when swapping obj.__dict__ with a dict-like object...

2005-04-06 Thread Steven Bethard
On Apr 5, 2005 8:46 PM, Brett C. <[EMAIL PROTECTED]> wrote: > Alex A. Naanou wrote: > > Here there are two problems, the first is minor, and it is that > > anything assigned to the __dict__ attribute is checked to be a > > descendant of the dict class (mixing this in does not seem to work)... > > a

Re: [Python-Dev] inconsistency when swapping obj.__dict__ with a dict-like object...

2005-04-05 Thread Brett C.
Alex A. Naanou wrote: > Hi! > > here is a simple piece of code > > ---cut--- > class Dict(dict): > def __init__(self, dct={}): > self._dict = dct > def __getitem__(self, name): > return self._dct[name] > def __setitem__(self, name, value): > self._dct[name] = v

[Python-Dev] inconsistency when swapping obj.__dict__ with a dict-like object...

2005-04-05 Thread Alex A. Naanou
Hi! here is a simple piece of code ---cut--- class Dict(dict): def __init__(self, dct={}): self._dict = dct def __getitem__(self, name): return self._dct[name] def __setitem__(self, name, value): self._dct[name] = value def __delitem__(self, name):