Re: class attribute to instance attribute
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: class attribute to instance attribute

From: Donnal Walter <donnal@donnal.net>
Date: Fri Jul 01 2005 - 14:41:39 CEST

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
Received on Thu Sep 29 16:41:23 2005