Replace Whole Object Through Object Method

Fredrik Lundh fredrik at pythonware.com
Tue Jun 27 11:58:56 CEST 2006


Bruno Desthuilliers wrote:

> As a matter of fact, in Python, the class is an attribute of an object.

except when it isn't.

>> def add_role(self, role_class):
>>    self.roles.append(role_class(self))
>
> And here you create a circular reference between object and roles...

and ?  Python has a garbage collector, you know...

</F> 






More information about the Python-list mailing list