Re: Figuring out what class instance contains you

2008-04-03 Thread Gabriel Genellina
En Fri, 04 Apr 2008 00:41:19 -0300, Alex VanderWoude <[EMAIL PROTECTED]> escribió: > Consider the following module: > > > class NewDict(dict): > parent = None > > def __setitem__(self, key, value): > print "My parent is", self.parent >

Figuring out what class instance contains you

2008-04-03 Thread Alex VanderWoude
Consider the following module: class NewDict(dict): parent = None def __setitem__(self, key, value): print "My parent is", self.parent super(NewDict, self).__setitem__(key, value) class Zero(object): children = NewDict() def