We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

(An Unofficial) Python Reference Wiki

This infogami wiki, a sister site to the Python Tutorial Wiki, contains a rough copy of the standard Python Language Reference. This document is currently undergoing some considerable copy editing.

Note: This subsite is pretty much broken after the site migration. Have patience.

Overviews (1)

method-index [method-index]

Articles (692)

A

abs [abs]

_

The __abs__ method [__abs__]
The __add__ method [__add__]

A

all [all]

_

__all__ [__all__]

A

The and operator [and]

_

The __and__ method [__and__]

A

any [any]
apply [apply]

A

ArithmeticError [ArithmeticError]

A

The as keyword [as]
Assert statements [assert]

A

AssertionError [AssertionError]

A

Assignment statements [assignments]
attribute-bases [attribute-bases]
attribute-class [attribute-class]
attribute-dict [attribute-dict]
attribute-doc [attribute-doc]

A

AttributeError [AttributeError]

A

attribute-metaclass [attribute-metaclass]
attribute-module [attribute-module]
attribute-name [attribute-name]
Attribute references [attribute-references]
attribute-slots [attribute-slots]

_

The __bases__ attribute [__bases__]

B

basestring [basestring]
blog [blog]
bool [bool]
The break statement [break]
buffer [buffer]

_

The __call__ method [__call__]

C

callable [callable]
Calls [calls]
chr [chr]
Class definitions [class]

_

The __class__ attribute [__class__]

C

classmethod [classmethod]
cmp [cmp]

_

The __cmp__ method [__cmp__]

C

coerce [coerce]

_

The __coerce__ method [__coerce__]

C

Coercion rules [coercion-rules]
recent comments [comments]
Comparisons [comparisons]
compile [compile]
complex [complex]

_

The __complex__ method [__complex__]

C

Compound statements [compound-statements]

_

The __contains__ method [__contains__]

C

contents [contents]

_

The __context__ method [__context__]

C

contextlib.contextfactory [contextlib]
contextlib.contextfactory [contextlib.contextfactory]
With Statement Contexts and Context Managers [context-managers]
The continue statement [continue]

_

The __debug__ variable [__debug__]

D

Function definitions [def]
The del statement [del]

_

The __del__ method [__del__]

D

delattr [delattr]

_

The __delattr__ method [__delattr__]
The __delete__ method [__delete__]

D

Delimiter Tokens [delimiter-tokens]

_

The __delitem__ method [__delitem__]
The __delslice__ method [__delslice__]

D

DeprecationWarning [DeprecationWarning]

D

Implementing Descriptors [descriptors]
dict [dict]

_

The __dict__ attribute [__dict__]

D

dict.clear [dict.clear]
dict.copy [dict.copy]
dict.fromkeys [dict.fromkeys]
dict.get [dict.get]
dict.has_key [dict.has_key]
Dictionary displays [dictionary-displays]
dict.items [dict.items]
dict.iteritems [dict.iteritems]
dict.iterkeys [dict.iterkeys]
dict.itervalues [dict.itervalues]
dict.keys [dict.keys]
dict.pop [dict.pop]
dict.popitem [dict.popitem]
dict.setdefault [dict.setdefault]
dict.update [dict.update]
dict.values [dict.values]
dir [dir]

_

The __div__ method [__div__]

D

divmod [divmod]

_

The __divmod__ method [__divmod__]
The __doc__ attribute [__doc__]

E

The elif clause [elif]

E

The Ellipsis constant [Ellipsis]

E

The else clause [else]
Emulating container types [emulating-container-types]

_

The __enter__ method [__enter__]

E

enumerate [enumerate]

E

EnvironmentError [EnvironmentError]
EOFError [EOFError]

_

The __eq__ method [__eq__]

E

eval [eval]
Evaluation order [evaluation-order]
The except clause [except]

E

Exception [Exception]

E

Exceptions [exceptions]
The exec statement [exec]
execfile [execfile]

_

The __exit__ method [__exit__]

E

Expression lists [expression-lists]
Expressions [expressions]
Expression statements [expression-statements]

F

The False constant [False]

F

file [file]

_

The __file__ attribute [__file__]

F

file.close [file.close]
file.closed [file.closed]
file.encoding [file.encoding]
file.fileno [file.fileno]
file.flush [file.flush]
file.isatty [file.isatty]
file.mode [file.mode]
file.name [file.name]
file.newlines [file.newlines]
file.next [file.next]
file.read [file.read]
file.readline [file.readline]
file.readlines [file.readlines]
file.seek [file.seek]
file.softspace [file.softspace]
file.tell [file.tell]
file.truncate [file.truncate]
file.write [file.write]
file.writelines [file.writelines]
file.xreadlines [file.xreadlines]
filter [filter]
The finally clause [finally]
float [float]

_

The __float__ method [__float__]

F

FloatingPointError [FloatingPointError]

F

Floating point literals [floating-point-literals]

_

The __floordiv__ method [__floordiv__]

F

The for statement [for]
The from keyword [from]
frozenset [frozenset]
Future statements [future]
The absolute_import future setting [future-absolute_import]

F

FutureWarning [FutureWarning]

F

The future_with future specifier [future-with_statement]

_

The __ge__ method [__ge__]

G

generator-expressions [generator-expressions]

_

The __get__ method [__get__]

G

getattr [getattr]

_

The __getattr__ method [__getattr__]
The __getattribute__ method [__getattribute__]
The __getitem__ method [__getitem__]
The __getslice__ method [__getslice__]

G

The global statement [global]
globals [globals]

_

The __gt__ method [__gt__]

H

hasattr [hasattr]
hash [hash]

_

The __hash__ method [__hash__]

H

help [help]
hex [hex]

_

The __hex__ method [__hex__]
The __iadd__ method [__iadd__]
The __iand__ method [__iand__]

I

id [id]
Identifiers [identifiers]

_

The __idiv__ method [__idiv__]

I

The if statement [if]

_

The __ifloordiv__ method [__ifloordiv__]
The __ilshift__ method [__ilshift__]

I

Imaginary literals [imaginary-literals]

_

The __imod__ method [__imod__]

I

Alternate Implementations [implementations]
The import statement [import]

I

ImportError [ImportError]

_

The __imul__ method [__imul__]

I

The in operator [in]

_

The __index__ method [__index__]

I

IndexError [IndexError]

_

The __init__ method [__init__]

I

input [input]
int [int]

_

The __int__ method [__int__]

I

Integer and long integer literals [integer-literals]
Descriptors [interface-descriptors]
Mappings [interface-mappings]
Numbers [interface-numbers]
Sequences [interface-sequences]
intern [intern]
Introduction [introduction]

_

The __invert__ method [__invert__]

I

Invoking Descriptors [invoking-descriptors]

I

IOError [IOError]

_

The __ior__ method [__ior__]
The __ipow__ method [__ipow__]
The __irshift__ method [__irshift__]

I

The is operator [is]
isinstance [isinstance]
The is not operator [is_not]
issubclass [issubclass]

_

The __isub__ method [__isub__]

I

iter [iter]

_

The __iter__ method [__iter__]
The __itruediv__ method [__itruediv__]
The __ixor__ method [__ixor__]

K

KeyboardInterrupt [KeyboardInterrupt]
KeyError [KeyError]

K

Keywords [keywords]

L

Lambdas [lambda]

_

The __le__ method [__le__]

L

len [len]

_

The __len__ method [__len__]

L

Lexical analysis [lexical-analysis]
list [list]
list.append [list.append]
list.count [list.count]
List displays [list-displays]
list.extend [list.extend]
list.index [list.index]
list.insert [list.insert]
list.pop [list.pop]
list.remove [list.remove]
list.reverse [list.reverse]
list.sort [list.sort]
Literals [literals]
locals [locals]
long [long]

_

The __long__ method [__long__]

L

LookupError [LookupError]

_

The __lshift__ method [__lshift__]
The __lt__ method [__lt__]

M

map [map]
max [max]

M

MemoryError [MemoryError]

_

The __metaclass__ attribute [__metaclass__]

M

method-abs [method-abs]
method-add [method-add]
method-and [method-and]
The __bases__ attribute [method-bases]
method-call [method-call]
The __class__ attribute [method-class]
method-cmp [method-cmp]
method-coerce [method-coerce]
method-complex [method-complex]
method-contains [method-contains]
method-context [method-context]
The __debug__ variable [method-debug]
method-del [method-del]
method-delattr [method-delattr]
method-delete [method-delete]
method-delitem [method-delitem]
method-delslice [method-delslice]
The __dict__ attribute [method-dict]
method-div [method-div]
method-divmod [method-divmod]
The __doc__ attribute [method-doc]
method-enter [method-enter]
method-eq [method-eq]
method-exit [method-exit]
method-float [method-float]
method-floordiv [method-floordiv]
method-ge [method-ge]
method-get [method-get]
method-getattr [method-getattr]
method-getattribute [method-getattribute]
method-getitem [method-getitem]
method-getslice [method-getslice]
method-gt [method-gt]
method-hash [method-hash]
method-hex [method-hex]
method-iadd [method-iadd]
method-iand [method-iand]
method-idiv [method-idiv]
method-ifloordiv [method-ifloordiv]
method-ilshift [method-ilshift]
method-imod [method-imod]
method-imul [method-imul]
method-init [method-init]
method-int [method-int]
method-invert [method-invert]
method-ior [method-ior]
method-ipow [method-ipow]
method-irshift [method-irshift]
method-isub [method-isub]
method-iter [method-iter]
method-itruediv [method-itruediv]
method-ixor [method-ixor]
method-le [method-le]
method-len [method-len]
method-long [method-long]
method-lshift [method-lshift]
method-lt [method-lt]
The __metaclass__ attribute [method-metaclass]
method-mod [method-mod]
The __module__ attribute [method-module]
method-mul [method-mul]
The __name__ attribute [method-name]
method-ne [method-ne]
method-neg [method-neg]
method-new [method-new]
method-nonzero [method-nonzero]
method-oct [method-oct]
method-or [method-or]
method-pos [method-pos]
method-pow [method-pow]
method-radd [method-radd]
method-rand [method-rand]
method-rcmp [method-rcmp]
method-rdiv [method-rdiv]
method-rdivmod [method-rdivmod]
method-repr [method-repr]
method-rfloordiv [method-rfloordiv]
method-rlshift [method-rlshift]
method-rmod [method-rmod]
method-rmul [method-rmul]
method-ror [method-ror]
method-rpow [method-rpow]
method-rrshift [method-rrshift]
method-rshift [method-rshift]
method-rsub [method-rsub]
method-rtruediv [method-rtruediv]
method-rxor [method-rxor]
method-set [method-set]
method-setattr [method-setattr]
method-setitem [method-setitem]
method-setslice [method-setslice]
The __slots__ attribute [method-slots]
method-str [method-str]
method-sub [method-sub]
method-truediv [method-truediv]
method-unicode [method-unicode]
method-xor [method-xor]
min [min]

_

The __mod__ method [__mod__]
The __module__ attribute [__module__]
The __mul__ method [__mul__]
The __name__ attribute [__name__]

N

NameError [NameError]

N

Naming and binding [naming-and-binding]

_

The __ne__ method [__ne__]
The __neg__ method [__neg__]
The __new__ method [__new__]

N

New-style and classic classes [new-style-and-classic-classes]
The next method [next]

N

The None constant [None]

_

The __nonzero__ method [__nonzero__]

N

The not operator [not]

N

The NotImplemented constant [NotImplemented]
NotImplementedError [NotImplementedError]

N

The not in operator [not_in]
Numeric literals [numeric-literals]

O

object [object]
Objects, values and types [objects]
oct [oct]

_

The __oct__ method [__oct__]

O

open [open]
operator-add [operator-add]
operator-and [operator-and]
Binary arithmetic operations [operator-binary]
Binary bit-wise operations [operator-bitwise]
Boolean operations [operator-boolean]
operator-div [operator-div]
operator-if [operator-if]
operator-invert [operator-invert]
operator-lshift [operator-lshift]
operator-mod [operator-mod]
operator-mul [operator-mul]
operator-neg [operator-neg]
operator-or [operator-or]
operator-pos [operator-pos]
operator-pow [operator-pow]
The power operator [operator-power]
operator-rshift [operator-rshift]
Operators [operators]
Shifting operations [operator-shift]
operator-sub [operator-sub]
Operator Tokens [operator-tokens]
Unary arithmetic operations [operator-unary]
operator-xor [operator-xor]
The or operator [or]

_

The __or__ method [__or__]

O

ord [ord]

O

OSError [OSError]
OverflowError [OverflowError]

_

pagetemplate [_pagetemplate]

P

Parenthesized forms [parenthesized-forms]
The pass statement [pass]

P

PendingDeprecationWarning [PendingDeprecationWarning]

_

The __pos__ method [__pos__]

P

pow [pow]

_

The __pow__ method [__pow__]

P

The print statement [print]
Top-level components [programs]
property [property]

_

The __radd__ method [__radd__]

R

The raise statement [raise]

_

The __rand__ method [__rand__]

R

range [range]
raw_input [raw_input]

_

The __rcmp__ method [__rcmp__]
The __rdiv__ method [__rdiv__]
The __rdivmod__ method [__rdivmod__]

R

reduce [reduce]

R

ReferenceError [ReferenceError]

R

Style Guide [reference-style]
reload [reload]
repr [repr]

_

The __repr__ method [__repr__]

R

Reserved classes of identifiers [reserved-identifier-classes]
The return statement [return]
reversed [reversed]

_

The __rfloordiv__ method [__rfloordiv__]
The __rlshift__ method [__rlshift__]
The __rmod__ method [__rmod__]
The __rmul__ method [__rmul__]
The __ror__ method [__ror__]

R

round [round]

_

The __rpow__ method [__rpow__]
The __rrshift__ method [__rrshift__]
The __rshift__ method [__rshift__]
The __rsub__ method [__rsub__]
The __rtruediv__ method [__rtruediv__]

R

RuntimeError [RuntimeError]
RuntimeWarning [RuntimeWarning]

_

The __rxor__ method [__rxor__]

S

set [set]

_

The __set__ method [__set__]

S

setattr [setattr]

_

The __setattr__ method [__setattr__]
The __setitem__ method [__setitem__]
The __setslice__ method [__setslice__]

S

Simple statements [simple-statements]
slice [slice]
Slicings [slicings]

_

The __slots__ attribute [__slots__]

S

sorted [sorted]
Special method names [special-method-names]

S

StandardError [StandardError]

S

staticmethod [staticmethod]

S

StopIteration [StopIteration]

S

str [str]

_

The __str__ method [__str__]

S

str.capitalize [str.capitalize]
str.center [str.center]
str.count [str.count]
str.decode [str.decode]
str.encode [str.encode]
str.endswith [str.endswith]
str.expandtabs [str.expandtabs]
str.find [str.find]
str.index [str.index]
string.zfill [string]
string.capitalize [string.capitalize]
string.center [string.center]
string-conversions [string-conversions]
string.count [string.count]
string.decode [string.decode]
string.encode [string.encode]
string.endswith [string.endswith]
string.expandtabs [string.expandtabs]
string.find [string.find]
string.index [string.index]
string.isalnum [string.isalnum]
string.isalpha [string.isalpha]
string.isdigit [string.isdigit]
string.islower [string.islower]
string.isspace [string.isspace]
string.istitle [string.istitle]
string.isupper [string.isupper]
string.join [string.join]
String literals [string-literals]
string.ljust [string.ljust]
string.lower [string.lower]
string.lstrip [string.lstrip]
string.partition [string.partition]
string.replace [string.replace]
string.rfind [string.rfind]
string.rindex [string.rindex]
string.rjust [string.rjust]
string.rpartition [string.rpartition]
string.rsplit [string.rsplit]
string.rstrip [string.rstrip]
string.split [string.split]
string.splitlines [string.splitlines]
string.startswith [string.startswith]
string.strip [string.strip]
string.swapcase [string.swapcase]
string.title [string.title]
string.translate [string.translate]
string.upper [string.upper]
string.zfill [string.zfill]
str.isalnum [str.isalnum]
str.isalpha [str.isalpha]
str.isdigit [str.isdigit]
str.islower [str.islower]
str.isspace [str.isspace]
str.istitle [str.istitle]
str.isupper [str.isupper]
str.join [str.join]
str.ljust [str.ljust]
str.lower [str.lower]
str.lstrip [str.lstrip]
str.partition [str.partition]
str.replace [str.replace]
str.rfind [str.rfind]
str.rindex [str.rindex]
str.rjust [str.rjust]
str.rpartition [str.rpartition]
str.rsplit [str.rsplit]
str.rstrip [str.rstrip]
str.split [str.split]
str.splitlines [str.splitlines]
str.startswith [str.startswith]
str.strip [str.strip]
str.swapcase [str.swapcase]
str.title [str.title]
str.translate [str.translate]
str.upper [str.upper]
str.zfill [str.zfill]

_

The __sub__ method [__sub__]

S

Subscriptions [subscriptions]
sum [sum]
super [super]
Syntax: atoms [syntax-atom]

S

SyntaxError [SyntaxError]

S

syntax-expression [syntax-expression]
Syntax: primaries [syntax-primary]
Syntax: Statements [syntax-statement]
syntax-suite [syntax-suite]
syntax-target [syntax-target]

S

SyntaxWarning [SyntaxWarning]

S

sys [sys]
sys.api_version [sys.api_version]
sys.argv [sys.argv]
sys.builtin_module_names [sys.builtin_module_names]
sys.byteorder [sys.byteorder]
sys.copyright [sys.copyright]
sys.displayhook [sys.displayhook]
sys.__displayhook__ [sys.__displayhook__]
sys.dllhandle [sys.dllhandle]
sys.exc_clear [sys.exc_clear]
sys.excepthook [sys.excepthook]
sys.__excepthook__ [sys.__excepthook__]
sys.exc_info [sys.exc_info]
sys.exc_traceback [sys.exc_traceback]
sys.exc_type [sys.exc_type]
sys.exc_value [sys.exc_value]
sys.exec_prefix [sys.exec_prefix]
sys.executable [sys.executable]
sys.exit [sys.exit]
sys.exitfunc [sys.exitfunc]
sys.getcheckinterval [sys.getcheckinterval]
sys.getdefaultencoding [sys.getdefaultencoding]
sys.getdlopenflags [sys.getdlopenflags]
sys.getfilesystemencoding [sys.getfilesystemencoding]
sys._getframe [sys._getframe]
sys.getrecursionlimit [sys.getrecursionlimit]
sys.getrefcount [sys.getrefcount]
sys.getwindowsversion [sys.getwindowsversion]
sys.hexversion [sys.hexversion]
sys.last_traceback [sys.last_traceback]
sys.last_type [sys.last_type]
sys.last_value [sys.last_value]
sys.maxint [sys.maxint]
sys.maxunicode [sys.maxunicode]
sys.modules [sys.modules]
sys.path [sys.path]
sys.platform [sys.platform]
sys.prefix [sys.prefix]
sys.ps1 [sys.ps1]
sys.ps2 [sys.ps2]
sys.setcheckinterval [sys.setcheckinterval]
sys.setdefaultencoding [sys.setdefaultencoding]
sys.setdlopenflags [sys.setdlopenflags]
sys.setprofile [sys.setprofile]
sys.setrecursionlimit [sys.setrecursionlimit]
sys.settrace [sys.settrace]
sys.settscdump [sys.settscdump]
sys.stderr [sys.stderr]
sys.__stderr__ [sys.__stderr__]
sys.stdin [sys.stdin]
sys.__stdin__ [sys.__stdin__]
sys.stdout [sys.stdout]
sys.__stdout__ [sys.__stdout__]

S

SystemError [SystemError]
SystemExit [SystemExit]

S

sys.tracebacklimit [sys.tracebacklimit]
sys.version [sys.version]
sys.version_info [sys.version_info]
sys.warnoptions [sys.warnoptions]
sys.winver [sys.winver]

_

template [_template]

T

Tokens [tokens]

T

The True constant [True]

_

The __truediv__ method [__truediv__]

T

The try statement [try]
tuple [tuple]
type [type]
Booleans [type-bool]
type-builtin-function [type-builtin-function]
type-callable [type-callable]
type-class [type-class]
type-classmethod [type-classmethod]
Code Objects [type-code]
Complex numbers [type-complex]
Dictionaries [type-dict]
Ellipsis [type-ellipsis]

T

TypeError [TypeError]

T

File objects [type-file]
Floating point numbers [type-float]
type-frame [type-frame]
Function Objects [type-function]
type-generator [type-generator]
type-instance [type-instance]
Plain integers [type-int]
Lists [type-list]
Long integers [type-long]
type-method [type-method]
type-module [type-module]
type-none [type-none]
type-notimplemented [type-notimplemented]
The standard type hierarchy [types]
Slice Objects [type-slice]
type-staticmethod [type-staticmethod]
type-str [type-str]
Strings [type-string]
type-traceback [type-traceback]
Tuples [type-tuple]
The type type [type-type]
Unicode [type-unicode]
type-xrange [type-xrange]

U

UnboundLocalError [UnboundLocalError]

U

unichr [unichr]
unicode [unicode]

_

The __unicode__ method [__unicode__]

U

unicode.capitalize [unicode.capitalize]
unicode.center [unicode.center]
unicode.count [unicode.count]
unicode.decode [unicode.decode]

U

UnicodeDecodeError [UnicodeDecodeError]

U

unicode.encode [unicode.encode]

U

UnicodeEncodeError [UnicodeEncodeError]

U

unicode.endswith [unicode.endswith]

U

UnicodeError [UnicodeError]

U

unicode.expandtabs [unicode.expandtabs]
unicode.find [unicode.find]
unicode.index [unicode.index]
unicode.isalnum [unicode.isalnum]
unicode.isalpha [unicode.isalpha]
unicode.isdigit [unicode.isdigit]
unicode.islower [unicode.islower]
unicode.isspace [unicode.isspace]
unicode.istitle [unicode.istitle]
unicode.isupper [unicode.isupper]
unicode.join [unicode.join]
unicode.ljust [unicode.ljust]
unicode.lower [unicode.lower]
unicode.lstrip [unicode.lstrip]
unicode.partition [unicode.partition]
unicode.replace [unicode.replace]
unicode.rfind [unicode.rfind]
unicode.rindex [unicode.rindex]
unicode.rjust [unicode.rjust]
unicode.rpartition [unicode.rpartition]
unicode.rsplit [unicode.rsplit]
unicode.rstrip [unicode.rstrip]
unicode.split [unicode.split]
unicode.splitlines [unicode.splitlines]
unicode.startswith [unicode.startswith]
unicode.strip [unicode.strip]
unicode.swapcase [unicode.swapcase]
unicode.title [unicode.title]
unicode.translate [unicode.translate]

U

UnicodeTranslateError [UnicodeTranslateError]

U

unicode.upper [unicode.upper]
unicode.zfill [unicode.zfill]

U

UserWarning [UserWarning]

V

ValueError [ValueError]

V

variable-debug [variable-debug]
vars [vars]

W

Warning [Warning]

W

The while statement [while]

W

WindowsError [WindowsError]

W

The with statement [with]
The with_statement future setting [with_statement]

_

The __xor__ method [__xor__]

X

xrange [xrange]

Y

The yield statement [yield]

Z

ZeroDivisionError [ZeroDivisionError]

Z

zip [zip]