code doesn't reference immutables?

Guilherme Polo ggpolo at gmail.com
Mon Jan 7 08:54:18 EST 2008


2008/1/7, MartinRinehart at gmail.com <MartinRinehart at gmail.com>:
> >From the manual:
>
> "code objects are immutable and contain no references (directly or
> indirectly) to mutable objects" (3.2)
>
> I thought my code worked with both mutable and immutable objects.
> Whassup?
>

What was your intention quoting this half-phrase ?
>From the same place, Python Reference Manual, 3.2:

Code objects:
Code objects represent byte-compiled executable Python code, or
bytecode. The difference between a code object and a function object
is that the function object contains an explicit reference to the
function's globals (the module in which it was defined), while a code
object contains no context; also the default argument values are
stored in the function object, not in the code object (because they
represent values calculated at run-time). Unlike function objects,
code objects are immutable and contain no references (directly or
indirectly) to mutable objects.

> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
-- Guilherme H. Polo Goncalves



More information about the Python-list mailing list