Scope troubles with a swap function

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Tue Aug 14 15:02:21 EDT 2001


Fri, 10 Aug 2001 21:45:47 GMT, Joseph Andrew Knapka <jknapka at earthlink.net> pisze:

> Just pass arguments. All names in Python have values that are either
> basic types (eg Integer) or references to objects (lists, tuples,
> class instances).

All values are references to objects, including integers.

At least conceptually. An alternative implementation could treat them
specially (in fact the CPython implementation preallocates 101 of
them to not have to always create them dynamically). But it's safe
to assume that they are all heap-allocated objects.

Since integers are immutable, the overall effect is the same as if
they were passed by value.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list