Eric, you misunderstood my point.
I said you make a **token** assignment in the class defn simply
to do two things:
- 1) identify all the members in one place
- 2) annotate each member's type, as much as you can
e.g.:
class C
s = []
d = {}
ot = (None, None)
I didn't say you make the actual assignment. Obviously you can't
in most cases.
Regards,
Stephen
>From: Eric Brunson <[EMAIL PROTECTED]>
>>Is this not just evidence of a very bad Python coding style?
>>Should we not always declare *all* class fields in the class definition
>>by assigning to them, even if the assignment is token or dummy
>>i.e. 'None', "", [], {} etc.
>>
>>
>
>Absolutely not. I have several classes that build themselves dynamically
>at runtime. As an example, one of them reads the data dictionary of a
>database. You may as well suggest that you define all your dictionary keys
>at the beginning of the program.
_________________________________________________________________
A new home for Mom, no cleanup required. All starts here.
http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor