Late-binding of function defaults (was Re: What is a function parameter =[] for?)
Emile van Sebille
emile at fenx.com
Wed Nov 25 13:51:12 EST 2015
On 11/25/2015 4:25 AM, Antoon Pardon wrote:
> I think there are reasons to find the above behaviour bizarre. I personnaly
> don't find it bizarre, but that is because I'm familiar with what is going
> on.
Which I suspect is necessary.
>but if someone expects the compilor to take a snapshot of L and iterate
> over that I am not going to say he shouldn't have expected that.
That's something I've learned to figure out about any new language I
pick up -- if parameters are passed by value or by reference, and
secondly how to invoke a function appropriately for my specific use case.
Unfortunately, there are issues determining if python is in either camp,
which certainly leads to confusion. see
http://www.python-course.eu/passing_arguments.php or google "python pass
by value or reference" for more examples.
Emile
More information about the Python-list
mailing list