X is confusing
nas at arctrix.com
Tue Jul 6 16:57:43 EDT 2004
On Tue, Jul 06, 2004 at 09:53:35PM +0100, Peter Mott wrote:
> Numbers less that 100 get True, more than 100 get False. It seems. What does
> this mean? If nothing, then why does it happen?
Small integer objects are cached to improve performance. It's an
implementation detail so don't count on it.
> I mean how do you explain 'is' or 'id(X)' to the first time
> programmer when it does this to you.
Use 'is' as it was intended (i.e. to test object identity).
More information about the Python-list