[Tutor] default parameters in classes
Kent Johnson
kent37 at tds.net
Mon Mar 12 13:29:44 CET 2007
J Greg wrote:
> I want my object to create a fresh dictionary if its
> not passed one.
>
> Perhaps I don't understand. In the example below, the
> first instance correctly creates a fresh dictionary.
> But the second instance seems to inherit the now dirty
> dictionary from the first instance.
>
> What am I missing?
http://www.effbot.org/pyfaq/why-are-default-values-shared-between-objects.htm
Kent
More information about the Tutor
mailing list