Mutable objects inside tuples - good or bad?
Terry Reedy
tjreedy at udel.edu
Mon Apr 7 20:16:05 EDT 2014
On 4/7/2014 11:26 AM, Paul Kölle wrote:
> >>> c = (1,2,3)
> >>> d = (1,2,3)
> >>> c is d
> False
An implementation would be allowed to make that True, as it does for
small ints and short strings that could be identifiers.
>>> a = 'one'
>>> b = 'one'
>>> a == b; a is b
True
True
However, duplicate tuples are much rarer than duplicate identifier strings.
--
Terry Jan Reedy
More information about the Python-list
mailing list