__iadd__ and fellows missing (Python 2.2)

Michael Hudson mwh at python.net
Sat Apr 13 08:04:18 EDT 2002


Philip Swartzleonard <starx at pacbell.net> writes:

> It appears that python only kees one copy of any given int around, 

Only for ints in the range 0...100, I think (might be -10...100 or
something now).

> and any name that happens to gain the status of being that integer
> really just gets another copy of it's pointer.

Yep.  This happens for the empty tuple, the empty string and one
character strings too (and maybe some other I forget now).

> It seems like it'd be less effort, but...

This is a performance & memory usage issue.

Cheers,
M.

-- 
  C is not clean -- the language has _many_ gotchas and traps, and
  although its semantics are _simple_ in some sense, it is not any
  cleaner than the assembly-language design it is based on.
                                        -- Erik Naggum, comp.lang.lisp



More information about the Python-list mailing list