keyword arguments and **

Boudewijn Rempt boud at valdyas.org
Sat Nov 16 06:50:00 EST 2002


John Hunter wrote:
> 
> The problem is with fields={}.  This is a famous problem that catches
> everybody at least once that is caused by using use a mutable type as
> the default value for a keyword argument.  A mutable type is one that
> can be changed (list, dict) and an immutable one is one that cannot
> (int, string, tuple, ...).

Thanks. I probably should have known better. I sort of assumed that I'd
get a new dictionary every time... I'll be implementing your suggestion
right away.
-- 
Boudewijn Rempt | http://www.valdyas.org



More information about the Python-list mailing list