Hi Collin,

> Here is a test program to demonstrate:
> 
> --------------------------------
> #!/usr/bin/env python3
> 
> def function(arg1, arg2 = dict()):
>     arg2[arg1] = 0
>     print(arg2)
> 
> function('one')
> function('two')
> function('three')
> --------------------------------
> 
> When executing the following is printed:
> 
>      {'one': 0}
>      {'one': 0, 'two': 0}
>      {'one': 0, 'two': 0, 'three': 0}

Oh, this is surprising. I would have expected that the default value
expression gets evaluated each time, not once only.

Thanks for the observation! Patch applied.

Bruno




Reply via email to