free variables /cell objects question
Duncan Booth
duncan.booth at invalid.invalid
Tue Jan 23 16:00:21 EST 2007
"gangesmaster" <tomerfiliba at gmail.com> wrote:
> ugliness :)
>
> so this is why [lambda: i for i in range(10)] will always return 9.
> imho that's a bug, not a feature.
Horses for courses.
There are cases where you need to get the latest value of the bound
variable, and there are cases where you want the value at the time it was
bound. For the latter case you have always been able to use default
arguments.
More information about the Python-list
mailing list