overriding __getitem__ for a subclass of dict

Steve Howell showell30 at yahoo.com
Sun Nov 15 14:23:01 EST 2009


On Nov 15, 10:25 am, Steve Howell <showel... at yahoo.com> wrote:
> [see original post...]
> I am most
> interested in the specific mechanism for changing the __getitem__
> method for a subclass on a dictionary.  Thanks in advance!

Sorry for replying to myself, but I just realized that the last
statement in my original post was a little imprecise.

I am more precisely looking for a way to change the behavior of foo
['bar'] (side effects and possibly return value) where "foo" is an
instance of a class that subclasses "dict," and where "foo" is not
created by me.  The original post gives more context and example code
that does not work as I expect/desire.




More information about the Python-list mailing list