mutable default parameter problem [Prothon]

Mark Hahn mark at prothon.org
Wed Jun 16 03:04:22 EDT 2004


Mark Hahn wrote:

> Fixing this will not break every use of
> [] as a default formal param.  Using [] in __init__ for example would
> break nothing.

Correction: Using [] as a default param is the same problem in __init__ as
it is anywhere else.  My brain went south for a moment.

My point still stands though.  There are many cases where a formal param can
default to [] and can be evaluated early or late without breaking the code.

My question asking for comments on code breakage also still stands.  Does
anyone have personal experience with usages of [] or {} as default params
that would break with late evaluation?  Is there any common idiom other than
the non-recommended use of them as static vars that would break?







More information about the Python-list mailing list