An Introduction to PythonGuido van Rossum Fred L. Drake, Jr., editor Python Software Foundation November 2006 (Release 2.5)
Copyright © 2001-2006 Python Software Foundation. All rights reserved. Copyright © 2000 BeOpen.com. All rights reserved. Copyright © 1995-2000 Corporation for National Research Initiatives. All rights reserved. Copyright © 1991-1995 Stichting Mathematisch Centrum. All rights reserved.
(1) Actually, call by object reference would be a better description, since if a mutable object is passed, the caller will see any changes the callee makes to it (items inserted into a list).
(2) The rules for comparing objects of different types should not be relied upon; they may change in a future version of the language.
(3) In fact function definitions are also `statements' that are `executed'; the execution enters the function name in the module's global symbol table.
Except for one thing. Module objects have a secret read-only attribute called
__dict__ which returns the dictionary used to implement the module's namespace; the name
__dict__ is an attribute but not a global name. Obviously, using this violates the abstraction of namespace implementation, and should be restricted to things like post-mortem debuggers.
(5) Python will execute the contents of a file identified by the ‘PYTHONSTARTUP’ environment variable when you start an interactive interpreter.
This requires the
operator module. Type
import operator; help(operator); for details.
|ISBN 0954161769||An Introduction to Python||See the print edition|