On Sun, Apr 6, 2014 at 1:25 AM, Chris Angelico <ros...@gmail.com> wrote:
> On Sun, Apr 6, 2014 at 5:55 PM, Devin Jeanpierre <jeanpierr...@gmail.com> 
> wrote:
>> Agreed. Putting mutable objects inside tuples is common and totally OK.
>
> There are many programming habits that can cause problems, even though
> they won't break Python and are legal code. :)

Yes, but this isn't one of them.

>> c is such that you could have another variable d, where the following
>> interpreter session fragment is easily possible:
>>
>>>>> c == d
>> True
>>>>> foo(c)
>>>>> c == d
>> False
>
> What you're looking at here is hashability, not mutability. Compare:

No, that is not what I am looking at. There are hashable objects with
the property I described, and unhashable objects without it.

My point in that example was that sometimes it is more useful to talk
about entire objects and their behavior as a whole. Calling the object
"immutable" when it has mutable state is misleading in this context.

-- Devin
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to