unintentionaly shared attributes in two different instances

maxm maxm at mxm.dk
Thu Dec 13 09:13:12 EST 2001


"Alexandre Fayolle" <alf at sagittarius.logilab.fr> wrote in message

> Don't use mutable primitives (lists, dictionaries or class instances) as
> default value in a method or function. See §4.7.1 in the Python tutorial:
>
> "Important warning: The default value is evaluated only once. This makes a
> difference when the default is a mutable object such as a list or
dictionary."

Bummer ... thanks!

regards Max M





More information about the Python-list mailing list