Bug in python!? persistent value of an optional parameter in function!
John Nagle
nagle at animats.com
Wed Mar 7 22:14:53 EST 2007
Paul Rubin wrote:
> "C Barr Leigh" <cpblPublic at gmail.com> writes:
>
>>Help! Have I found a serious bug?
>>This seems like highly undesired behaviour to me. From the program
>>below, I get output:
>
>
> It is intentional, not a bug, see the docs. Whether it's desirable is
> a different question.
True. It would make sense to disallow mutable values as
initial values for optional arguments. The present behavior
is silly.
John Nagle
More information about the Python-list
mailing list