id( ) function question
lists at cheimes.de
Wed Oct 14 13:32:45 CEST 2009
Andre Engels schrieb:
> What is going on is that a few objects that are often used, in
> particular the small (how small is small depends on the
> implementation) integers, are 'preloaded'. When one of these is then
> referred to, a new object is not created, but the pre-defined object
> is used. 10 is apparently a preloaded constant in your implementation,
> 1e10 is not.
> As far as I know, only None is _guaranteed_ to be such a preloaded
> object, so one should not rely on it in implementations.
None, True, False, NotImplemented are guaranteed to be singletons, all
builtin types and exceptions can be considered as singletons, too.
More information about the Python-list