Python is wierd!

Greg Ewing to_get_my_address at see.my.signature
Thu Jul 27 01:01:11 EDT 2000


Jonathan wrote:
> 
> you can even declare a instance
> variable out of the <class> scope(am i right?)

Strictly speaking, you never "declare" anything in Python. Even
the class and def statements are executable statements that create
an object and put a reference to it in the current namespace.

And to answer your question, yes, you can create an instance
variable at any time simply by executing "instance.name = value".

-- 
Greg Ewing, Computer Science Department, 
University of Canterbury, New Zealand
To get my email address, please visit my web page:
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list