[Doc-SIG] Does the "is" operator only matter for mutable object?
Steven D'Aprano
steve at pearwood.info
Sat Mar 5 04:13:53 CET 2011
INADA Naoki wrote:
> In
> http://docs.python.org/py3k/tutorial/datastructures.html#comparing-sequences-and-other-types
> ,
>
> The operators is and is notcompare whether two objects are really the same
>> object;
>> this only matters for mutable objects like lists.
>
>
> I think this notation may confuse readers of the tutorial. For example, pep8
> recommands
> using is operator for immutable singleton objects like None.
>
> Shall we remove letter part?
Rather than completely remove it, I would reword it:
The operators is and is not compare whether two objects are really the
same object; this usually only matters for mutable objects like lists,
or for testing against singletons like None.
--
Steven
More information about the Doc-SIG
mailing list