String Identity Test

Terry Reedy tjreedy at udel.edu
Thu Mar 5 17:06:48 CET 2009


Hendrik van Rooyen wrote:
> "S Arrowsmith" <si...intbox.UUCP> wrote:
> 
>> "Small" integers get a similar treatment:
>>
>>>>> a = 256
>>>>> b = 256
>>>>> a is b
>> True
>>>>> a = 257
>>>>> b = 257
>>>>> a is b
>> False
> 
> This is weird - I would have thought that the limit
> of "small" would be at 255 - the biggest number to 
> fit in a byte.  256 takes two bytes, so it must be
> an arbitrary limit - could have been set at 300,
> or 30 000...

'Small' also goes to -10 or so.  256 was included, at minuscule cost, 
because it is a relatively common number, being the number of bytes.




More information about the Python-list mailing list