Re: Defining __getitem__() in a class that inherits from (dict)

2005-03-08 Thread Tobiah
My appreciation for your responses is not easily imparted through text. Thank You. Steven Bethard wrote: Michael Hoffman wrote: Tobiah wrote: If within the __getitem__ method I attempt to get an item from self, the __getitem__ method is called in an infinite recursion. You need to explicitly use

Re: Defining __getitem__() in a class that inherits from (dict)

2005-03-08 Thread Steven Bethard
Michael Hoffman wrote: Tobiah wrote: If within the __getitem__ method I attempt to get an item from self, the __getitem__ method is called in an infinite recursion. You need to explicitly use dict.__getitem__(self, key) instead of using self[key] directly. or super(bar, self).__getitem__(key) STeVe

Re: Defining __getitem__() in a class that inherits from (dict)

2005-03-08 Thread Michael Hoffman
Tobiah wrote: If within the __getitem__ method I attempt to get an item from self, the __getitem__ method is called in an infinite recursion. You need to explicitly use dict.__getitem__(self, key) instead of using self[key] directly. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/pyt

Defining __getitem__() in a class that inherits from (dict)

2005-03-08 Thread Tobiah
#!/usr/bin/python # Hi, # # I noticed something interesting when trying to define # the __getitem__() method in a class that inherits from # (dict). If within the __getitem__ method I attempt # to get an item from self, the __getitem__ method is # called in an infinite recursion. I am very fond o