- publishing free software manuals

Python Language Reference Manual

Guido 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) http://www.jython.org/

(2) http://www.zope.org/Members/Brian/PythonNet

(3) http://workspaces.gotdotnet.com/ironpython

(4) http://codespeak.net/pypy/

(5) In versions of Python prior to 2.4, octal and hexadecimal literals in the range just above the largest representable plain integer but below the largest unsigned 32-bit number (on a machine using 32-bit arithmetic), 4294967296, were taken as the negative plain integer obtained by subtracting 4294967296 from their unsigned value.

(6) Since Python 2.2, a gradual merging of types and classes has been started that makes this and a few other assertions made in this manual not 100% accurate and complete: for example, it is now possible in some cases to change an object's type, under certain controlled conditions. Until this manual undergoes extensive revision, it must now be taken as authoritative only regarding "classic classes", that are still the default, for compatibility purposes, in Python 2.2 and 2.3. For more information, see http://www.python.org/doc/newstyle.html.

(7) This, and other statements, are only roughly true for instances of new-style classes.

(8) For operands of the same type, it is assumed that if the non-reflected method (such as __add__()) fails the operation is not supported, which is why the reflected method is not called.

(9) This limitation occurs because the code that is executed by these operations is not available at the time the module is compiled.

(10) In Python 2.3, a list comprehension "leaks" the control variables of each ‘for’ it contains into the containing scope. However, this behavior is deprecated, and relying on it will not work once this bug is fixed in a future release

(11) While abs(x%y) < abs(y) is true mathematically, for floats it may not be true numerically due to roundoff. For example, and assuming a platform on which a Python float is an IEEE 754 double-precision number, in order that -1e-100 % 1e100 have the same sign as 1e100, the computed result is -1e-100 + 1e100, which is numerically exactly equal to 1e100. Function fmod() in the ‘math’ module returns a result whose sign matches the sign of the first argument instead, and so returns -1e-100 in this case. Which approach is more appropriate depends on the application.

(12) If x is very close to an exact integer multiple of y, it is possible for floor(x/y) to be one larger than (x-x%y)/y due to rounding. In such cases, Python returns the latter result, in order to preserve that divmod(x,y)[0] * y + x %{} y be very close to x.

(13) The implementation computes this efficiently, without constructing lists or sorting.

(14) Earlier versions of Python used lexicographic comparison of the sorted (key, value) lists, but this was very expensive for the common case of comparing for equality. An even earlier version of Python compared dictionaries by identity only, but this caused surprises because people expected to be able to test a dictionary for emptiness by comparing it to {}.

(15) It may occur within an except or else clause. The restriction on occurring in the try clause is implementor's laziness and will eventually be lifted.

(16) See http://www.python.org/doc/essays/packages.html for details.

(17) The exception is propogated to the invocation stack only if there is no finally clause that negates the exception.

(18) Currently, control "flows off the end" except in the case of an exception or the execution of a return, continue, or break statement.

(19) http://www.wide.ad.jp/about/index.html

ISBN 0954161785Python Language Reference ManualSee the print edition