class attribute to instance attribute

Donnal Walter donnal at donnal.net
Fri Jul 1 08:41:39 EDT 2005


Devan L wrote:

> Why make it an instance attribute? Couldn't you just look at
 > the class attribute?

Each "presenter" (instance) needs its own "view" (instance). The class 
attribute references a wxPython class. The resulting instance attribute 
references a wxPython object (widget or container).

> If its something that depends on each instance's value
> assigned to the attribute, why not make it an instance attribute to
> start with?

The view instance is not known at design time; it can only be created at 
runtime. To do this requires doing so in the __init__() method, either 
in a separate version method for every different presenter class, or 
once in the superclass, as I have done.

Donnal





More information about the Python-list mailing list