Author rhettinger
Recipients antlong, dmalcolm, pitrou, rhettinger
Date 2011-04-14.21:39:24
SpamBayes Score 6.17121e-08
Marked as misclassified No
Message-id <1302817165.08.0.275078955654.issue11846@psf.upfronthosting.co.za>
In-reply-to
Content
We should remove the documentation entries that discuss non-guaranteed implementation details (i.e. which integers are singletons).

Instead, there should probably be a brief tutorial entry on what aspects of object identity people can rely on:

* None, True, and False are singletons.  PEP 8 recommends testing for None with "is".

* Most internal equality comparisons (i.e. that in list.count or list.__contains__) assume that identity-implied-equality regardless of how __eq__ is defined (i.e. an object is always equal to itself).

* Once created, an object doesn't change its identity.  So, you can use "is" to find the exact same object at a later stage in a program.

* Unless documented otherwise (a singleton class telling you that it returns the same object every time), no other assumptions should be made about object identity.  In particular, one cannot assume that an object id won't be re-used after the object is reclaimed.
History
Date User Action Args
2011-04-14 21:39:25rhettingersetrecipients: + rhettinger, pitrou, dmalcolm, antlong
2011-04-14 21:39:25rhettingersetmessageid: <1302817165.08.0.275078955654.issue11846@psf.upfronthosting.co.za>
2011-04-14 21:39:24rhettingerlinkissue11846 messages
2011-04-14 21:39:24rhettingercreate