Default Value

Rotwang sg552 at hotmail.co.uk
Fri Jun 21 13:47:56 EDT 2013


On 21/06/2013 18:01, Rick Johnson wrote:
>
> [stuff]

It isn't clear to me from your posts what exactly you're proposing as an 
alternative to the way Python's default argument binding works. In your 
version of Python, what exactly would happen when I passed a mutable 
argument as a default value in a def statement? E.g. this:

 >>> a = [1, 2, 3]
 >>> a.append(a)
 >>> b = object()
 >>> def f(x = [None, b, [a, [4]]]):
...     pass # do something

What would you like to see the interpreter do in this case?



More information about the Python-list mailing list