Python meta object question
aahz at netcom.com
Tue Nov 30 00:37:09 CET 1999
In article <3842D025.3283C871 at linux-france.org>,
Mickael Remond <mikl at linux-france.org> wrote:
>Is there a way to automatically update the class tree to show the change
>in inherited class attributes after a class redefinition ?
The problem is that the original class definition still has references
to it as long as there are instances of that class. Your problem is
that you're trying to make inheritance do the work of object
composition; a much better way to handle this specific problem is to
create an instance of a company object, set self.companyName, then pass
that company object to each of the employees. When you update that
central company instance, each employee instance will automatically
access the new information.
--- Aahz (@netcom.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
Question authority: ask me anything!
More information about the Python-list