Late-binding of function defaults (was Re: What is a function parameter =[] for?)

Marko Rauhamaa marko at pacujo.net
Thu Nov 26 07:03:47 EST 2015


Chris Angelico <rosuav at gmail.com>:

> On Thu, Nov 26, 2015 at 10:23 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
>> It's not letting me in the case of list.
>
> Actually it is. Your mistake is trying to use a list as a dict key.
> You have a solution available: use a tuple.

Yes, or wrap the list in a class.


Marko



More information about the Python-list mailing list