Re: __getitem__ on new-style classes

2005-03-10 Thread Michael Spencer
[EMAIL PROTECTED] wrote: What i'm trying to do is tie special methods of a "proxy" instance to another instance: ... new style classes: def test2(): print "test2" class Container(object): def __init__( self, data ): self.data = data # self.__dict__["__getitem__"] = self.data.__ge

__getitem__ on new-style classes

2005-03-10 Thread simon
What i'm trying to do is tie special methods of a "proxy" instance to another instance: def test1(): class Container: def __init__( self, data ): self.data = data self.__getitem__ = self.data.__getitem__ data = range(10) c = Container(data) print "test1" print c[3] This