On 2005-06-12, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Fascinating. With small strings, it uses the same object, and with
> small numbers like 3. With 300 they were different objects (why,
It's purely an implimentation detail. The small integers get
used a lot, so Python keeps a pre-created set of small integers
handy. It would be a bit, uh, wasteful to pre-create all of
possible integer objects, so "large" integers get created on
the fly without checking to see if there are any existing ones
with the right value. Large integers could get cached and
re-used, but that would be extra overhead with little chance
for benefit.
> shouldn't they both be ints still?)
They are.
--
Grant Edwards grante Yow! .. over in west
at Philadelphia a puppy is
visi.com vomiting...
--
http://mail.python.org/mailman/listinfo/python-list