Default argument to __init__

skip at pobox.com skip at pobox.com
Mon Oct 10 11:27:14 EDT 2005


    vaibhav> Here's a piece of Python code and it's output. The output that
    vaibhav> Python shows is not as per my expectation. Hope someone can
    vaibhav> explain to me this behaviour:
    ...


Yes, your default arg is evaluated once, at method definition time and
shared betwee all instances of MyClass.  See the thread last week on the
same thing for more detail.

Skip



More information about the Python-list mailing list