Late-binding of function defaults (was Re: What is a function parameter =[] for?)
Marko Rauhamaa
marko at pacujo.net
Thu Nov 26 16:36:13 EST 2015
Gregory Ewing <greg.ewing at canterbury.ac.nz>:
> Marko Rauhamaa wrote:
>> What I'm saying is that Python does not prevent mutable keys but
>> tries to do that with lists and tuples.
>>
>> I think Python should stop trying.
>
> Do you volunteer to answer all the posts from beginners complaining
> that "the dict type is broken" because they used a list as a key and
> then mutated it?
What happened to consenting adults?
Even Java (of all languages) allows lists to be keys and simply notes:
Note: great care must be exercised if mutable objects are used as map
keys.
<URL: http://docs.oracle.com/javase/7/docs/api/java/util/Map.html>
Marko
More information about the Python-list
mailing list