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

Steven Bethard steven.bethard at gmail.com
Wed Apr 6 16:43:44 CEST 2005


On Apr 5, 2005 8:46 PM, Brett C. <bac at ocf.berkeley.edu> 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)...
> > and the second problem is a real annoyance, it is that the mapping
> > protocol supported by the Dict object in the example above is not used
> > by the attribute access mechanics (the same thing that once happened
> > in exec)...
>
> Actually, overriding __getattribute__() does work; __getattr__() and
> __getitem__() doesn't.  This was brought up last month at some point without
> any resolve (I think Steve Bethard pointed it out).

Yeah, here's the link:

http://mail.python.org/pipermail/python-dev/2005-March/051837.html

I've pointed out three possible "solutions" there, but they all have
some significant drawbacks.  I took the complete silence on the topic
as an indication that none of the options were acceptable.

STeVe
--
You can wordify anything if you just verb it.
       --- Bucky Katt, Get Fuzzy


More information about the Python-Dev mailing list