2# Autogenerated by Sphinx on Sun May 10 13:12:18 2015
3 topics = {'assert': u'\nThe "assert" statement\n**********************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\nassert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, "assert expression", is equivalent to\n\nif __debug__:\nif not expression: raise AssertionError\n\nThe extended form, "assert expression1, expression2", is equivalent to\n\nif __debug__:\nif not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that "__debug__" and "AssertionError" refer\nto the built-in variables with those names. In the current\nimplementation, the built-in variable "__debug__" is "True" under\nnormal circumstances, "False" when optimization is requested (command\nline option -O). The current code generator emits no code for an\nassert statement when optimization is requested at compile time. Note\nthat it is unnecessary to include the source code for the expression\nthat failed in the error message; it will be displayed as part of the\nstack trace.\n\nAssignments to "__debug__" are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n',
4'assignment': u'\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\nassignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)\ntarget_list ::= target ("," target)* [","]\ntarget ::= identifier\n| "(" target_list ")"\n| "[" target_list "]"\n| attributeref\n| subscription\n| slicing\n\n(See section Primaries for the syntax definitions for the last three\nsymbols.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section The standard type\nhierarchy).\n\nAssignment of an object to a target list is recursively defined as\nfollows.\n\n* If the target list is a single target: The object is assigned to\nthat target.\n\n* If the target list is a comma-separated list of targets: The\nobject must be an iterable with the same number of items as there\nare targets in the target list, and the items are assigned, from\nleft to right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n* If the name does not occur in a "global" statement in the\ncurrent code block: the name is bound to the object in the current\nlocal namespace.\n\n* Otherwise: the name is bound to the object in the current global\nnamespace.\n\nThe name is rebound if it was already bound. This may cause the\nreference count for the object previously bound to the name to reach\nzero, causing the object to be deallocated and its destructor (if it\nhas one) to be called.\n\n* If the target is a target list enclosed in parentheses or in\nsquare brackets: The object must be an iterable with the same number\nof items as there are targets in the target list, and its items are\nassigned, from left to right, to the corresponding targets.\n\n* If the target is an attribute reference: The primary expression in\nthe reference is evaluated. It should yield an object with\nassignable attributes; if this is not the case, "TypeError" is\nraised. That object is then asked to assign the assigned object to\nthe given attribute; if it cannot perform the assignment, it raises\nan exception (usually but not necessarily "AttributeError").\n\nNote: If the object is a class instance and the attribute reference\noccurs on both sides of the assignment operator, the RHS expression,\n"a.x" can access either an instance attribute or (if no instance\nattribute exists) a class attribute. The LHS target "a.x" is always\nset as an instance attribute, creating it if necessary. Thus, the\ntwo occurrences of "a.x" do not necessarily refer to the same\nattribute: if the RHS expression refers to a class attribute, the\nLHS creates a new instance attribute as the target of the\nassignment:\n\nclass Cls:\nx = 3 # class variable\ninst = Cls()\ninst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3\n\nThis description does not necessarily apply to descriptor\nattributes, such as properties created with "property()".\n\n* If the target is a subscription: The primary expression in the\nreference is evaluated. It should yield either a mutable sequence\nobject (such as a list) or a mapping object (such as a dictionary).\nNext, the subscript expression is evaluated.\n\nIf the primary is a mutable sequence object (such as a list), the\nsubscript must yield a plain integer. If it is negative, the\nsequence\'s length is added to it. The resulting value must be a\nnonnegative integer less than the sequence\'s length, and the\nsequence is asked to assign the assigned object to its item with\nthat index. If the index is out of range, "IndexError" is raised\n(assignment to a subscripted sequence cannot add new items to a\nlist).\n\nIf the primary is a mapping object (such as a dictionary), the\nsubscript must have a type compatible with the mapping\'s key type,\nand the mapping is then asked to create a key/datum pair which maps\nthe subscript to the assigned object. This can either replace an\nexisting key/value pair with the same key value, or insert a new\nkey/value pair (if no key with the same value existed).\n\n* If the target is a slicing: The primary expression in the\nreference is evaluated. It should yield a mutable sequence object\n(such as a list). The assigned object should be a sequence object\nof the same type. Next, the lower and upper bound expressions are\nevaluated, insofar they are present; defaults are zero and the\nsequence\'s length. The bounds should evaluate to (small) integers.\nIf either bound is negative, the sequence\'s length is added to it.\nThe resulting bounds are clipped to lie between zero and the\nsequence\'s length, inclusive. Finally, the sequence object is asked\nto replace the slice with the items of the assigned sequence. The\nlength of the slice may be different from the length of the assigned\nsequence, thus changing the length of the target sequence, if the\nobject allows it.\n\n**CPython implementation detail:** In the current implementation, the\nsyntax for targets is taken to be the same as for expressions, and\ninvalid syntax is rejected during the code generation phase, causing\nless detailed error messages.\n\nWARNING: Although the definition of assignment implies that overlaps\nbetween the left-hand side and the right-hand side are\'safe\'(for\nexample "a, b = b, a" swaps two variables), overlaps *within* the\ncollection of assigned-to variables are not safe! For instance, the\nfollowing program prints "[0, 2]":\n\nx = [0, 1]\ni = 0\ni, x[i] = 1, 2\nprint x\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\naugmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\naugtarget ::= identifier | attributeref | subscription | slicing\naugop ::= "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="\n| ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section Primaries for the syntax definitions for the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same caveat about\nclass and instance attributes applies as for regular assignments.\n',
5'atom-identifiers': u'\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name. See section Identifiers\nand keywords for lexical definition and section Naming and binding for\ndocumentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a "NameError" exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them. The transformation inserts the\nclass name, with leading underscores removed and a single underscore\ninserted, in front of the name. For example, the identifier "__spam"\noccurring in a class named "Ham" will be transformed to "_Ham__spam".\nThis transformation is independent of the syntactical context in which\nthe identifier is used. If the transformed name is extremely long\n(longer than 255 characters), implementation defined truncation may\nhappen. If the class name consists only of underscores, no\ntransformation is done.\n',
6'atom-literals': u"\nLiterals\n********\n\nPython supports string literals and various numeric literals:\n\nliteral ::= stringliteral | integer | longinteger\n| floatnumber | imagnumber\n\nEvaluation of a literal yields an object of the given type (string,\ninteger, long integer, floating point number, complex number) with the\ngiven value. The value may be approximated in the case of floating\npoint and imaginary (complex) literals. See section Literals for\ndetails.\n\nAll literals correspond to immutable data types, and hence the\nobject's identity is less important than its value. Multiple\nevaluations of literals with the same value (either the same\noccurrence in the program text or a different occurrence) may obtain\nthe same object or a different object with the same value.\n",
7'attribute-access': u'\nCustomizing attribute access\n****************************\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\nCalled when an attribute lookup has not found the attribute in the\nusual places (i.e. it is not an instance attribute nor is it found\nin the class tree for "self"). "name" is the attribute name. This\nmethod should return the (computed) attribute value or raise an\n"AttributeError" exception.\n\nNote that if the attribute is found through the normal mechanism,\n"__getattr__()" is not called. (This is an intentional asymmetry\nbetween "__getattr__()" and "__setattr__()".) This is done both for\nefficiency reasons and because otherwise "__getattr__()" would have\nno way to access other attributes of the instance. Note that at\nleast for instance variables, you can fake total control by not\ninserting any values in the instance attribute dictionary (but\ninstead inserting them in another object). See the\n"__getattribute__()" method below for a way to actually get total\ncontrol in new-style classes.\n\nobject.__setattr__(self, name, value)\n\nCalled when an attribute assignment is attempted. This is called\ninstead of the normal mechanism (i.e. store the value in the\ninstance dictionary). *name* is the attribute name, *value* is the\nvalue to be assigned to it.\n\nIf "__setattr__()" wants to assign to an instance attribute, it\nshould not simply execute "self.name = value" --- this would cause\na recursive call to itself. Instead, it should insert the value in\nthe dictionary of instance attributes, e.g., "self.__dict__[name] =\nvalue". For new-style classes, rather than accessing the instance\ndictionary, it should call the base class method with the same\nname, for example, "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\nLike "__setattr__()" but for attribute deletion instead of\nassignment. This should only be implemented if "del obj.name" is\nmeaningful for the object.\n\n\nMore attribute access for new-style classes\n===========================================\n\nThe following methods only apply to new-style classes.\n\nobject.__getattribute__(self, name)\n\nCalled unconditionally to implement attribute accesses for\ninstances of the class. If the class also defines "__getattr__()",\nthe latter will not be called unless "__getattribute__()" either\ncalls it explicitly or raises an "AttributeError". This method\nshould return the (computed) attribute value or raise an\n"AttributeError" exception. In order to avoid infinite recursion in\nthis method, its implementation should always call the base class\nmethod with the same name to access any attributes it needs, for\nexample, "object.__getattribute__(self, name)".\n\nNote: This method may still be bypassed when looking up special\nmethods as the result of implicit invocation via language syntax\nor built-in functions. See Special method lookup for new-style\nclasses.\n\n\nImplementing Descriptors\n========================\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\'"__dict__".\n\nobject.__get__(self, instance, owner)\n\nCalled to get the attribute of the owner class (class attribute\naccess) or of an instance of that class (instance attribute\naccess). *owner* is always the owner class, while *instance* is the\ninstance that the attribute was accessed through, or "None" when\nthe attribute is accessed through the *owner*. This method should\nreturn the (computed) attribute value or raise an "AttributeError"\nexception.\n\nobject.__set__(self, instance, value)\n\nCalled to set the attribute on an instance *instance* of the owner\nclass to a new value, *value*.\n\nobject.__delete__(self, instance)\n\nCalled to delete the attribute on an instance *instance* of the\nowner class.\n\n\nInvoking Descriptors\n====================\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called. Note that descriptors are only invoked for new\nstyle objects or classes (ones that subclass "object()" or "type()").\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\nThe simplest and least common call is when user code directly\ninvokes a descriptor method: "x.__get__(a)".\n\nInstance Binding\nIf binding to a new-style object instance, "a.x" is transformed\ninto the call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\nIf binding to a new-style class, "A.x" is transformed into the\ncall: "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\nIf "a" is an instance of "super", then the binding "super(B,\nobj).m()" searches "obj.__class__.__mro__" for the base class "A"\nimmediately preceding "B" and then invokes the descriptor with the\ncall: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()". If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary. If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor. Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method. Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n=========\n\nBy default, instances of both old and new-style classes have a\ndictionary for attribute storage. This wastes space for objects\nhaving very few instance variables. The space consumption can become\nacute when creating large numbers of instances.\n\nThe default can be overridden by defining *__slots__* in a new-style\nclass definition. The *__slots__* declaration takes a sequence of\ninstance variables and reserves just enough space in each instance to\nhold a value for each variable. Space is saved because *__dict__* is\nnot created for each instance.\n\n__slots__\n\nThis class variable can be assigned a string, iterable, or sequence\nof strings with variable names used by instances. If defined in a\nnew-style class, *__slots__* reserves space for the declared\nvariables and prevents the automatic creation of *__dict__* and\n*__weakref__* for each instance.\n\nNew in version 2.2.\n\nNotes on using *__slots__*\n\n* When inheriting from a class without *__slots__*, the *__dict__*\nattribute of that class will always be accessible, so a *__slots__*\ndefinition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\nvariables not listed in the *__slots__* definition. Attempts to\nassign to an unlisted variable name raises "AttributeError". If\ndynamic assignment of new variables is desired, then add\n"\'__dict__\'" to the sequence of strings in the *__slots__*\ndeclaration.\n\nChanged in version 2.3: Previously, adding "\'__dict__\'" to the\n*__slots__* declaration would not enable the assignment of new\nattributes not specifically listed in the sequence of instance\nvariable names.\n\n* Without a *__weakref__* variable for each instance, classes\ndefining *__slots__* do not support weak references to its\ninstances. If weak reference support is needed, then add\n"\'__weakref__\'" to the sequence of strings in the *__slots__*\ndeclaration.\n\nChanged in version 2.3: Previously, adding "\'__weakref__\'" to the\n*__slots__* declaration would not enable support for weak\nreferences.\n\n* *__slots__* are implemented at the class level by creating\ndescriptors (Implementing Descriptors) for each variable name. As a\nresult, class attributes cannot be used to set default values for\ninstance variables defined by *__slots__*; otherwise, the class\nattribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\nwhere it is defined. As a result, subclasses will have a *__dict__*\nunless they also define *__slots__* (which must only contain names\nof any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\ninstance variable defined by the base class slot is inaccessible\n(except by retrieving its descriptor directly from the base class).\nThis renders the meaning of the program undefined. In the future, a\ncheck may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n"variable-length" built-in types such as "long", "str" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\nmay also be used; however, in the future, special meaning may be\nassigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n*__slots__*.\n\nChanged in version 2.6: Previously, *__class__* assignment raised an\nerror if either new or old class had *__slots__*.\n',
8'attribute-references': u'\nAttribute references\n********************\n\nAn attribute reference is a primary followed by a period and a name:\n\nattributeref ::= primary "." identifier\n\nThe primary must evaluate to an object of a type that supports\nattribute references, e.g., a module, list, or an instance. This\nobject is then asked to produce the attribute whose name is the\nidentifier. If this attribute is not available, the exception\n"AttributeError" is raised. Otherwise, the type and value of the\nobject produced is determined by the object. Multiple evaluations of\nthe same attribute reference may yield different objects.\n',
9'augassign': u'\nAugmented assignment statements\n*******************************\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\naugmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\naugtarget ::= identifier | attributeref | subscription | slicing\naugop ::= "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="\n| ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section Primaries for the syntax definitions for the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same caveat about\nclass and instance attributes applies as for regular assignments.\n',
10'binary': u'\nBinary arithmetic operations\n****************************\n\nThe binary arithmetic operations have the conventional priority\nlevels. Note that some of these operations also apply to certain non-\nnumeric types. Apart from the power operator, there are only two\nlevels, one for multiplicative operators and one for additive\noperators:\n\nm_expr ::= u_expr | m_expr "*" u_expr | m_expr "//" u_expr | m_expr "/" u_expr\n| m_expr "%" u_expr\na_expr ::= m_expr | a_expr "+" m_expr | a_expr "-" m_expr\n\nThe "*" (multiplication) operator yields the product of its arguments.\nThe arguments must either both be numbers, or one argument must be an\ninteger (plain or long) and the other must be a sequence. In the\nformer case, the numbers are converted to a common type and then\nmultiplied together. In the latter case, sequence repetition is\nperformed; a negative repetition factor yields an empty sequence.\n\nThe "/" (division) and "//" (floor division) operators yield the\nquotient of their arguments. The numeric arguments are first\nconverted to a common type. Plain or long integer division yields an\ninteger of the same type; the result is that of mathematical division\nwith the\'floor\'function applied to the result. Division by zero\nraises the "ZeroDivisionError" exception.\n\nThe "%" (modulo) operator yields the remainder from the division of\nthe first argument by the second. The numeric arguments are first\nconverted to a common type. A zero right argument raises the\n"ZeroDivisionError" exception. The arguments may be floating point\nnumbers, e.g., "3.14%0.7" equals "0.34" (since "3.14" equals "4*0.7 +\n0.34".) The modulo operator always yields a result with the same sign\nas its second operand (or zero); the absolute value of the result is\nstrictly smaller than the absolute value of the second operand [2].\n\nThe integer division and modulo operators are connected by the\nfollowing identity: "x == (x/y)*y + (x%y)". Integer division and\nmodulo are also connected with the built-in function "divmod()":\n"divmod(x, y) == (x/y, x%y)". These identities don\'t hold for\nfloating point numbers; there similar identities hold approximately\nwhere "x/y" is replaced by "floor(x/y)" or "floor(x/y) - 1" [3].\n\nIn addition to performing the modulo operation on numbers, the "%"\noperator is also overloaded by string and unicode objects to perform\nstring formatting (also known as interpolation). The syntax for string\nformatting is described in the Python Library Reference, section\nString Formatting Operations.\n\nDeprecated since version 2.3: The floor division operator, the modulo\noperator, and the "divmod()" function are no longer defined for\ncomplex numbers. Instead, convert to a floating point number using\nthe "abs()" function if appropriate.\n\nThe "+" (addition) operator yields the sum of its arguments. The\narguments must either both be numbers or both sequences of the same\ntype. In the former case, the numbers are converted to a common type\nand then added together. In the latter case, the sequences are\nconcatenated.\n\nThe "-" (subtraction) operator yields the difference of its arguments.\nThe numeric arguments are first converted to a common type.\n',
11'bitwise': u'\nBinary bitwise operations\n*************************\n\nEach of the three bitwise operations has a different priority level:\n\nand_expr ::= shift_expr | and_expr "&" shift_expr\nxor_expr ::= and_expr | xor_expr "^" and_expr\nor_expr ::= xor_expr | or_expr "|" xor_expr\n\nThe "&" operator yields the bitwise AND of its arguments, which must\nbe plain or long integers. The arguments are converted to a common\ntype.\n\nThe "^" operator yields the bitwise XOR (exclusive OR) of its\narguments, which must be plain or long integers. The arguments are\nconverted to a common type.\n\nThe "|" operator yields the bitwise (inclusive) OR of its arguments,\nwhich must be plain or long integers. The arguments are converted to\na common type.\n',
12'bltin-code-objects': u'\nCode Objects\n************\n\nCode objects are used by the implementation to represent "pseudo-\ncompiled" executable Python code such as a function body. They differ\nfrom function objects because they don\'t contain a reference to their\nglobal execution environment. Code objects are returned by the built-\nin "compile()" function and can be extracted from function objects\nthrough their "func_code" attribute. See also the "code" module.\n\nA code object can be executed or evaluated by passing it (instead of a\nsource string) to the "exec" statement or the built-in "eval()"\nfunction.\n\nSee The standard type hierarchy for more information.\n',
13'bltin-ellipsis-object': u'\nThe Ellipsis Object\n*******************\n\nThis object is used by extended slice notation (see Slicings). It\nsupports no special operations. There is exactly one ellipsis object,\nnamed "Ellipsis" (a built-in name).\n\nIt is written as "Ellipsis". When in a subscript, it can also be\nwritten as "...", for example "seq[...]".\n',
14'bltin-null-object': u'\nThe Null Object\n***************\n\nThis object is returned by functions that don\'t explicitly return a\nvalue. It supports no special operations. There is exactly one null\nobject, named "None" (a built-in name).\n\nIt is written as "None".\n',
15'bltin-type-objects': u'\nType Objects\n************\n\nType objects represent the various object types. An object\'s type is\naccessed by the built-in function "type()". There are no special\noperations on types. The standard module "types" defines names for\nall standard built-in types.\n\nTypes are written like this: "<type\'int\'>".\n',
16'booleans': u'\nBoolean operations\n******************\n\nor_test ::= and_test | or_test "or" and_test\nand_test ::= not_test | and_test "and" not_test\nnot_test ::= comparison | "not" not_test\n\nIn the context of Boolean operations, and also when expressions are\nused by control flow statements, the following values are interpreted\nas false: "False", "None", numeric zero of all types, and empty\nstrings and containers (including strings, tuples, lists,\ndictionaries, sets and frozensets). All other values are interpreted\nas true. (See the "__nonzero__()" special method for a way to change\nthis.)\n\nThe operator "not" yields "True" if its argument is false, "False"\notherwise.\n\nThe expression "x and y" first evaluates *x*; if *x* is false, its\nvalue is returned; otherwise, *y* is evaluated and the resulting value\nis returned.\n\nThe expression "x or y" first evaluates *x*; if *x* is true, its value\nis returned; otherwise, *y* is evaluated and the resulting value is\nreturned.\n\n(Note that neither "and" nor "or" restrict the value and type they\nreturn to "False" and "True", but rather return the last evaluated\nargument. This is sometimes useful, e.g., if "s" is a string that\nshould be replaced by a default value if it is empty, the expression\n"s or\'foo\'" yields the desired value. Because "not" has to invent a\nvalue anyway, it does not bother to return a value of the same type as\nits argument, so e.g., "not\'foo\'" yields "False", not "\'\'".)\n',
17'break': u'\nThe "break" statement\n*********************\n\nbreak_stmt ::= "break"\n\n"break" may only occur syntactically nested in a "for" or "while"\nloop, but not nested in a function or class definition within that\nloop.\n\nIt terminates the nearest enclosing loop, skipping the optional "else"\nclause if the loop has one.\n\nIf a "for" loop is terminated by "break", the loop control target\nkeeps its current value.\n\nWhen "break" passes control out of a "try" statement with a "finally"\nclause, that "finally" clause is executed before really leaving the\nloop.\n',
18'callable-types': u'\nEmulating callable objects\n**************************\n\nobject.__call__(self[, args...])\n\nCalled when the instance is "called" as a function; if this method\nis defined, "x(arg1, arg2, ...)" is a shorthand for\n"x.__call__(arg1, arg2, ...)".\n',
19'calls': u'\nCalls\n*****\n\nA call calls a callable object (e.g., a *function*) with a possibly\nempty series of *arguments*:\n\ncall ::= primary "(" [argument_list [","]\n| expression genexpr_for] ")"\nargument_list ::= positional_arguments ["," keyword_arguments]\n["," "*" expression] ["," keyword_arguments]\n["," "**" expression]\n| keyword_arguments ["," "*" expression]\n["," "**" expression]\n| "*" expression ["," keyword_arguments] ["," "**" expression]\n| "**" expression\npositional_arguments ::= expression ("," expression)*\nkeyword_arguments ::= keyword_item ("," keyword_item)*\nkeyword_item ::= identifier "=" expression\n\nA trailing comma may be present after the positional and keyword\narguments but does not affect the semantics.\n\nThe primary must evaluate to a callable object (user-defined\nfunctions, built-in functions, methods of built-in objects, class\nobjects, methods of class instances, and certain class instances\nthemselves are callable; extensions may define additional callable\nobject types). All argument expressions are evaluated before the call\nis attempted. Please refer to section Function definitions for the\nsyntax of formal *parameter* lists.\n\nIf keyword arguments are present, they are first converted to\npositional arguments, as follows. First, a list of unfilled slots is\ncreated for the formal parameters. If there are N positional\narguments, they are placed in the first N slots. Next, for each\nkeyword argument, the identifier is used to determine the\ncorresponding slot (if the identifier is the same as the first formal\nparameter name, the first slot is used, and so on). If the slot is\nalready filled, a "TypeError" exception is raised. Otherwise, the\nvalue of the argument is placed in the slot, filling it (even if the\nexpression is "None", it fills the slot). When all arguments have\nbeen processed, the slots that are still unfilled are filled with the\ncorresponding default value from the function definition. (Default\nvalues are calculated, once, when the function is defined; thus, a\nmutable object such as a list or dictionary used as default value will\nbe shared by all calls that don\'t specify an argument value for the\ncorresponding slot; this should usually be avoided.) If there are any\nunfilled slots for which no default value is specified, a "TypeError"\nexception is raised. Otherwise, the list of filled slots is used as\nthe argument list for the call.\n\n**CPython implementation detail:** An implementation may provide\nbuilt-in functions whose positional parameters do not have names, even\nif they are\'named\'for the purpose of documentation, and which\ntherefore cannot be supplied by keyword. In CPython, this is the case\nfor functions implemented in C that use "PyArg_ParseTuple()" to parse\ntheir arguments.\n\nIf there are more positional arguments than there are formal parameter\nslots, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "*identifier" is present; in this case, that formal\nparameter receives a tuple containing the excess positional arguments\n(or an empty tuple if there were no excess positional arguments).\n\nIf any keyword argument does not correspond to a formal parameter\nname, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "**identifier" is present; in this case, that formal\nparameter receives a dictionary containing the excess keyword\narguments (using the keywords as keys and the argument values as\ncorresponding values), or a (new) empty dictionary if there were no\nexcess keyword arguments.\n\nIf the syntax "*expression" appears in the function call, "expression"\nmust evaluate to an iterable. Elements from this iterable are treated\nas if they were additional positional arguments; if there are\npositional arguments *x1*, ..., *xN*, and "expression" evaluates to a\nsequence *y1*, ..., *yM*, this is equivalent to a call with M+N\npositional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n\nA consequence of this is that although the "*expression" syntax may\nappear *after* some keyword arguments, it is processed *before* the\nkeyword arguments (and the "**expression" argument, if any -- see\nbelow). So:\n\n>>> def f(a, b):\n... print a, b\n...\n>>> f(b=1, *(2,))\n2 1\n>>> f(a=1, *(2,))\nTraceback (most recent call last):\nFile "<stdin>", line 1, in ?\nTypeError: f() got multiple values for keyword argument\'a\'\n>>> f(1, *(2,))\n1 2\n\nIt is unusual for both keyword arguments and the "*expression" syntax\nto be used in the same call, so in practice this confusion does not\narise.\n\nIf the syntax "**expression" appears in the function call,\n"expression" must evaluate to a mapping, the contents of which are\ntreated as additional keyword arguments. In the case of a keyword\nappearing in both "expression" and as an explicit keyword argument, a\n"TypeError" exception is raised.\n\nFormal parameters using the syntax "*identifier" or "**identifier"\ncannot be used as positional argument slots or as keyword argument\nnames. Formal parameters using the syntax "(sublist)" cannot be used\nas keyword argument names; the outermost sublist corresponds to a\nsingle unnamed argument slot, and the argument value is assigned to\nthe sublist using the usual tuple assignment rules after all other\nparameter processing is done.\n\nA call always returns some value, possibly "None", unless it raises an\nexception. How this value is computed depends on the type of the\ncallable object.\n\nIf it is---\n\na user-defined function:\nThe code block for the function is executed, passing it the\nargument list. The first thing the code block will do is bind the\nformal parameters to the arguments; this is described in section\nFunction definitions. When the code block executes a "return"\nstatement, this specifies the return value of the function call.\n\na built-in function or method:\nThe result is up to the interpreter; see Built-in Functions for the\ndescriptions of built-in functions and methods.\n\na class object:\nA new instance of that class is returned.\n\na class instance method:\nThe corresponding user-defined function is called, with an argument\nlist that is one longer than the argument list of the call: the\ninstance becomes the first argument.\n\na class instance:\nThe class must define a "__call__()" method; the effect is then the\nsame as if that method was called.\n',
20'class': u'\nClass definitions\n*****************\n\nA class definition defines a class object (see section The standard\ntype hierarchy):\n\nclassdef ::= "class" classname [inheritance] ":" suite\ninheritance ::= "(" [expression_list] ")"\nclassname ::= identifier\n\nA class definition is an executable statement. It first evaluates the\ninheritance list, if present. Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing. The class\'s suite is then executed in a new execution\nframe (see section Naming and binding), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.) When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. [4] A class object is then created using the inheritance list\nfor the base classes and the saved local namespace for the attribute\ndictionary. The class name is bound to this class object in the\noriginal local namespace.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by all instances. To create instance\nvariables, they can be set in a method with "self.name = value". Both\nclass and instance variables are accessible through the notation\n""self.name"", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results. For *new-style class*es, descriptors can\nbe used to create instance variables with different implementation\ndetails.\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions. The evaluation rules for the decorator\nexpressions are the same as for functions. The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless\nthere is a "finally" clause which happens to raise another\nexception. That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of\nan exception or the execution of a "return", "continue", or\n"break" statement.\n\n[3] A string literal appearing as the first statement in the\nfunction body is transformed into the function\'s "__doc__"\nattribute and therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\nbody is transformed into the namespace\'s "__doc__" item and\ntherefore the class\'s *docstring*.\n',
21'comparisons': u'\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like "a < b < c" have the\ninterpretation that is conventional in mathematics:\n\ncomparison ::= or_expr ( comp_operator or_expr )*\ncomp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | "!="\n| "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: "True" or "False".\n\nComparisons can be chained arbitrarily, e.g., "x < y <= z" is\nequivalent to "x < y and y <= z", except that "y" is evaluated only\nonce (but in both cases "z" is not evaluated at all when "x < y" is\nfound to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... y\nopN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except\nthat each expression is evaluated at most once.\n\nNote that "a op1 b op2 c" doesn\'t imply any kind of comparison between\n*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\nperhaps not pretty).\n\nThe forms "<>" and "!=" are equivalent; for consistency with C, "!="\nis preferred; where "!=" is mentioned below "<>" is also accepted.\nThe "<>" spelling is considered obsolescent.\n\nThe operators "<", ">", "==", ">=", "<=", and "!=" compare the values\nof two objects. The objects need not have the same type. If both are\nnumbers, they are converted to a common type. Otherwise, objects of\ndifferent types *always* compare unequal, and are ordered consistently\nbut arbitrarily. You can control comparison behavior of objects of\nnon-built-in types by defining a "__cmp__" method or rich comparison\nmethods like "__gt__", described in section Special method names.\n\n(This unusual definition of comparison was used to simplify the\ndefinition of operations like sorting and the "in" and "not in"\noperators. In the future, the comparison rules for objects of\ndifferent types are likely to change.)\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* Strings are compared lexicographically using the numeric\nequivalents (the result of the built-in function "ord()") of their\ncharacters. Unicode and 8-bit strings are fully interoperable in\nthis behavior. [4]\n\n* Tuples and lists are compared lexicographically using comparison\nof corresponding elements. This means that to compare equal, each\nelement must compare equal and the two sequences must be of the same\ntype and have the same length.\n\nIf not equal, the sequences are ordered the same as their first\ndiffering elements. For example, "cmp([1,2,x], [1,2,y])" returns\nthe same as "cmp(x,y)". If the corresponding element does not\nexist, the shorter sequence is ordered first (for example, "[1,2] <\n[1,2,3]").\n\n* Mappings (dictionaries) compare equal if and only if their sorted\n(key, value) lists compare equal. [5] Outcomes other than equality\nare resolved consistently, but are not otherwise defined. [6]\n\n* Most other objects of built-in types compare unequal unless they\nare the same object; the choice whether one object is considered\nsmaller or larger than another one is made arbitrarily but\nconsistently within one execution of a program.\n\nThe operators "in" and "not in" test for collection membership. "x in\ns" evaluates to true if *x* is a member of the collection *s*, and\nfalse otherwise. "x not in s" returns the negation of "x in s". The\ncollection membership test has traditionally been bound to sequences;\nan object is a member of a collection if the collection is a sequence\nand contains an element equal to that object. However, it make sense\nfor many other object types to support membership tests without being\na sequence. In particular, dictionaries (for keys) and sets support\nmembership testing.\n\nFor the list and tuple types, "x in y" is true if and only if there\nexists an index *i* such that "x == y[i]" is true.\n\nFor the Unicode and string types, "x in y" is true if and only if *x*\nis a substring of *y*. An equivalent test is "y.find(x) != -1".\nNote, *x* and *y* need not be the same type; consequently, "u\'ab\'in\n\'abc\'" will return "True". Empty strings are always considered to be a\nsubstring of any other string, so """ in "abc"" will return "True".\n\nChanged in version 2.3: Previously, *x* was required to be a string of\nlength "1".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" is true if and only if "y.__contains__(x)" is true.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is true if some value "z" with "x == z"\nis produced while iterating over "y". If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is true if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n\nThe operators "is" and "is not" test for object identity: "x is y" is\ntrue if and only if *x* and *y* are the same object. "x is not y"\nyields the inverse truth value. [7]\n',
22'compound': u'\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way. In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe "if", "while" and "for" statements implement traditional control\nflow constructs. "try" specifies exception handlers and/or cleanup\ncode for a group of statements. Function and class definitions are\nalso syntactically compound statements.\n\nCompound statements consist of one or more\'clauses.\'A clause\nconsists of a header and a\'suite.\'The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon. A suite is a group of statements controlled by a\nclause. A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines. Only the latter form of suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which "if" clause a following "else" clause would belong:\n\nif test1: if test2: print x\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n"print" statements are executed:\n\nif x < y < z: print x; print y; print z\n\nSummarizing:\n\ncompound_stmt ::= if_stmt\n| while_stmt\n| for_stmt\n| try_stmt\n| with_stmt\n| funcdef\n| classdef\n| decorated\nsuite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\nstatement ::= stmt_list NEWLINE | compound_stmt\nstmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a "NEWLINE" possibly followed by a\n"DEDENT". Also note that optional continuation clauses always begin\nwith a keyword that cannot start a statement, thus there are no\nambiguities (the\'dangling "else"\'problem is solved in Python by\nrequiring nested "if" statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe "if" statement\n==================\n\nThe "if" statement is used for conditional execution:\n\nif_stmt ::= "if" expression ":" suite\n( "elif" expression ":" suite )*\n["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section Boolean operations\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n\n\nThe "while" statement\n=====================\n\nThe "while" statement is used for repeated execution as long as an\nexpression is true:\n\nwhile_stmt ::= "while" expression ":" suite\n["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the "else" clause, if present, is executed\nand the loop terminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and goes back\nto testing the expression.\n\n\nThe "for" statement\n===================\n\nThe "for" statement is used to iterate over the elements of a sequence\n(such as a string, tuple or list) or other iterable object:\n\nfor_stmt ::= "for" target_list "in" expression_list ":" suite\n["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n"expression_list". The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments, and then the suite is executed. When the items are\nexhausted (which is immediately when the sequence is empty), the suite\nin the "else" clause, if present, is executed, and the loop\nterminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and continues\nwith the next item, or with the "else" clause if there was no next\nitem.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nThe target list is not deleted when the loop is finished, but if the\nsequence is empty, it will not have been assigned to at all by the\nloop. Hint: the built-in function "range()" returns a sequence of\nintegers suitable to emulate the effect of Pascal\'s "for i := a to b\ndo"; e.g., "range(3)" returns the list "[0, 1, 2]".\n\nNote: There is a subtlety when the sequence is being modified by the\nloop (this can only occur for mutable sequences, i.e. lists). An\ninternal counter is used to keep track of which item is used next,\nand this is incremented on each iteration. When this counter has\nreached the length of the sequence the loop terminates. This means\nthat if the suite deletes the current (or a previous) item from the\nsequence, the next item will be skipped (since it gets the index of\nthe current item which has already been treated). Likewise, if the\nsuite inserts an item in the sequence before the current item, the\ncurrent item will be treated again the next time through the loop.\nThis can lead to nasty bugs that can be avoided by making a\ntemporary copy using a slice of the whole sequence, e.g.,\n\nfor x in a[:]:\nif x < 0: a.remove(x)\n\n\nThe "try" statement\n===================\n\nThe "try" statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\ntry_stmt ::= try1_stmt | try2_stmt\ntry1_stmt ::= "try" ":" suite\n("except" [expression [("as" | ",") identifier]] ":" suite)+\n["else" ":" suite]\n["finally" ":" suite]\ntry2_stmt ::= "try" ":" suite\n"finally" ":" suite\n\nChanged in version 2.5: In previous versions of Python,\n"try"..."except"..."finally" did not work. "try"..."except" had to be\nnested in "try"..."finally".\n\nThe "except" clause(s) specify one or more exception handlers. When no\nexception occurs in the "try" clause, no exception handler is\nexecuted. When an exception occurs in the "try" suite, a search for an\nexception handler is started. This search inspects the except clauses\nin turn until one is found that matches the exception. An expression-\nless except clause, if present, must be last; it matches any\nexception. For an except clause with an expression, that expression\nis evaluated, and the clause matches the exception if the resulting\nobject is "compatible" with the exception. An object is compatible\nwith an exception if it is the class or a base class of the exception\nobject, or a tuple containing an item compatible with the exception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire "try" statement raised\nthe exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified in that except clause, if present, and the except\nclause\'s suite is executed. All except clauses must have an\nexecutable block. When the end of this block is reached, execution\ncontinues normally after the entire try statement. (This means that\nif two nested handlers exist for the same exception, and the exception\noccurs in the try clause of the inner handler, the outer handler will\nnot handle the exception.)\n\nBefore an except clause\'s suite is executed, details about the\nexception are assigned to three variables in the "sys" module:\n"sys.exc_type" receives the object identifying the exception;\n"sys.exc_value" receives the exception\'s parameter;\n"sys.exc_traceback" receives a traceback object (see section The\nstandard type hierarchy) identifying the point in the program where\nthe exception occurred. These details are also available through the\n"sys.exc_info()" function, which returns a tuple "(exc_type,\nexc_value, exc_traceback)". Use of the corresponding variables is\ndeprecated in favor of this function, since their use is unsafe in a\nthreaded program. As of Python 1.5, the variables are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional "else" clause is executed if and when control flows off\nthe end of the "try" clause. [2] Exceptions in the "else" clause are\nnot handled by the preceding "except" clauses.\n\nIf "finally" is present, it specifies a\'cleanup\'handler. The "try"\nclause is executed, including any "except" and "else" clauses. If an\nexception occurs in any of the clauses and is not handled, the\nexception is temporarily saved. The "finally" clause is executed. If\nthere is a saved exception, it is re-raised at the end of the\n"finally" clause. If the "finally" clause raises another exception or\nexecutes a "return" or "break" statement, the saved exception is\ndiscarded:\n\n>>> def f():\n... try:\n... 1/0\n... finally:\n... return 42\n...\n>>> f()\n42\n\nThe exception information is not available to the program during\nexecution of the "finally" clause.\n\nWhen a "return", "break" or "continue" statement is executed in the\n"try" suite of a "try"..."finally" statement, the "finally" clause is\nalso executed\'on the way out.\'A "continue" statement is illegal in\nthe "finally" clause. (The reason is a problem with the current\nimplementation --- this restriction may be lifted in the future).\n\nThe return value of a function is determined by the last "return"\nstatement executed. Since the "finally" clause always executes, a\n"return" statement executed in the "finally" clause will always be the\nlast one executed:\n\n>>> def foo():\n... try:\n... return\'try\'\n... finally:\n... return\'finally\'\n...\n>>> foo()\n \'finally\'\n\nAdditional information on exceptions can be found in section\nExceptions, and information on using the "raise" statement to generate\nexceptions may be found in section The raise statement.\n\n\nThe "with" statement\n====================\n\nNew in version 2.5.\n\nThe "with" statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section With Statement\nContext Managers). This allows common "try"..."except"..."finally"\nusage patterns to be encapsulated for convenient reuse.\n\nwith_stmt ::= "with" with_item ("," with_item)* ":" suite\nwith_item ::= expression ["as" target]\n\nThe execution of the "with" statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the "with_item")\nis evaluated to obtain a context manager.\n\n2. The context manager\'s "__exit__()" is loaded for later use.\n\n3. The context manager\'s "__enter__()" method is invoked.\n\n4. If a target was included in the "with" statement, the return\nvalue from "__enter__()" is assigned to it.\n\nNote: The "with" statement guarantees that if the "__enter__()"\nmethod returns without an error, then "__exit__()" will always be\ncalled. Thus, if an error occurs during the assignment to the\ntarget list, it will be treated the same as an error occurring\nwithin the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s "__exit__()" method is invoked. If an\nexception caused the suite to be exited, its type, value, and\ntraceback are passed as arguments to "__exit__()". Otherwise, three\n"None" arguments are supplied.\n\nIf the suite was exited due to an exception, and the return value\nfrom the "__exit__()" method was false, the exception is reraised.\nIf the return value was true, the exception is suppressed, and\nexecution continues with the statement following the "with"\nstatement.\n\nIf the suite was exited for any reason other than an exception, the\nreturn value from "__exit__()" is ignored, and execution proceeds\nat the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple "with" statements were nested:\n\nwith A() as a, B() as b:\nsuite\n\nis equivalent to\n\nwith A() as a:\nwith B() as b:\nsuite\n\nNote: In Python 2.5, the "with" statement is only allowed when the\n"with_statement" feature has been enabled. It is always enabled in\nPython 2.6.\n\nChanged in version 2.7: Support for multiple context expressions.\n\nSee also: **PEP 0343** - The "with" statement\n\nThe specification, background, and examples for the Python "with"\nstatement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection The standard type hierarchy):\n\ndecorated ::= decorators (classdef | funcdef)\ndecorators ::= decorator+\ndecorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\nfuncdef ::= "def" funcname "(" [parameter_list] ")" ":" suite\ndotted_name ::= identifier ("." identifier)*\nparameter_list ::= (defparameter ",")*\n( "*" identifier ["," "**" identifier]\n| "**" identifier\n| defparameter [","] )\ndefparameter ::= parameter ["=" expression]\nsublist ::= parameter ("," parameter)* [","]\nparameter ::= identifier | "(" sublist ")"\nfuncname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code:\n\n@f1(arg)\n@f2\ndef func(): pass\n\nis equivalent to:\n\ndef func(): pass\nfunc = f1(arg)(f2(func))\n\nWhen one or more top-level *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters must also have a default value --- this is a syntactic\nrestriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that the same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use "None" as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\ndef whats_on_the_telly(penguin=None):\nif penguin is None:\npenguin = []\npenguin.append("property of the zoo")\nreturn penguin\n\nFunction call semantics are described in more detail in section Calls.\nA function call always assigns values to all parameters mentioned in\nthe parameter list, either from position arguments, from keyword\narguments, or from default values. If the form ""*identifier"" is\npresent, it is initialized to a tuple receiving any excess positional\nparameters, defaulting to the empty tuple. If the form\n""**identifier"" is present, it is initialized to a new dictionary\nreceiving any excess keyword arguments, defaulting to a new empty\ndictionary.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda\nexpressions, described in section Lambdas. Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression. The ""def"" form is actually more powerful since it\nallows the execution of multiple statements.\n\n**Programmer\'s note:** Functions are first-class objects. A ""def""\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section Naming and binding for details.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section The standard\ntype hierarchy):\n\nclassdef ::= "class" classname [inheritance] ":" suite\ninheritance ::= "(" [expression_list] ")"\nclassname ::= identifier\n\nA class definition is an executable statement. It first evaluates the\ninheritance list, if present. Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing. The class\'s suite is then executed in a new execution\nframe (see section Naming and binding), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.) When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. [4] A class object is then created using the inheritance list\nfor the base classes and the saved local namespace for the attribute\ndictionary. The class name is bound to this class object in the\noriginal local namespace.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by all instances. To create instance\nvariables, they can be set in a method with "self.name = value". Both\nclass and instance variables are accessible through the notation\n""self.name"", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results. For *new-style class*es, descriptors can\nbe used to create instance variables with different implementation\ndetails.\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions. The evaluation rules for the decorator\nexpressions are the same as for functions. The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless\nthere is a "finally" clause which happens to raise another\nexception. That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of\nan exception or the execution of a "return", "continue", or\n"break" statement.\n\n[3] A string literal appearing as the first statement in the\nfunction body is transformed into the function\'s "__doc__"\nattribute and therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\nbody is transformed into the namespace\'s "__doc__" item and\ntherefore the class\'s *docstring*.\n',
23'context-managers': u'\nWith Statement Context Managers\n*******************************\n\nNew in version 2.5.\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section The with\nstatement), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see Context Manager Types.\n\nobject.__enter__(self)\n\nEnter the runtime context related to this object. The "with"\nstatement will bind this method\'s return value to the target(s)\nspecified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\nExit the runtime context related to this object. The parameters\ndescribe the exception that caused the context to be exited. If the\ncontext was exited without an exception, all three arguments will\nbe "None".\n\nIf an exception is supplied, and the method wishes to suppress the\nexception (i.e., prevent it from being propagated), it should\nreturn a true value. Otherwise, the exception will be processed\nnormally upon exit from this method.\n\nNote that "__exit__()" methods should not reraise the passed-in\nexception; this is the caller\'s responsibility.\n\nSee also: **PEP 0343** - The "with" statement\n\nThe specification, background, and examples for the Python "with"\nstatement.\n',
24'continue': u'\nThe "continue" statement\n************************\n\ncontinue_stmt ::= "continue"\n\n"continue" may only occur syntactically nested in a "for" or "while"\nloop, but not nested in a function or class definition or "finally"\nclause within that loop. It continues with the next cycle of the\nnearest enclosing loop.\n\nWhen "continue" passes control out of a "try" statement with a\n"finally" clause, that "finally" clause is executed before really\nstarting the next loop cycle.\n',
25'conversions': u'\nArithmetic conversions\n**********************\n\nWhen a description of an arithmetic operator below uses the phrase\n"the numeric arguments are converted to a common type," the arguments\nare coerced using the coercion rules listed at Coercion rules. If\nboth arguments are standard numeric types, the following coercions are\napplied:\n\n* If either argument is a complex number, the other is converted to\ncomplex;\n\n* otherwise, if either argument is a floating point number, the\nother is converted to floating point;\n\n* otherwise, if either argument is a long integer, the other is\nconverted to long integer;\n\n* otherwise, both must be plain integers and no conversion is\nnecessary.\n\nSome additional rules apply for certain operators (e.g., a string left\nargument to the\'%\'operator). Extensions can define their own\ncoercions.\n',
26'customization': u'\nBasic customization\n*******************\n\nobject.__new__(cls[, ...])\n\nCalled to create a new instance of class *cls*. "__new__()" is a\nstatic method (special-cased so you need not declare it as such)\nthat takes the class of which an instance was requested as its\nfirst argument. The remaining arguments are those passed to the\nobject constructor expression (the call to the class). The return\nvalue of "__new__()" should be the new object instance (usually an\ninstance of *cls*).\n\nTypical implementations create a new instance of the class by\ninvoking the superclass\'s "__new__()" method using\n"super(currentclass, cls).__new__(cls[, ...])" with appropriate\narguments and then modifying the newly-created instance as\nnecessary before returning it.\n\nIf "__new__()" returns an instance of *cls*, then the new\ninstance\'s "__init__()" method will be invoked like\n"__init__(self[, ...])", where *self* is the new instance and the\nremaining arguments are the same as were passed to "__new__()".\n\nIf "__new__()" does not return an instance of *cls*, then the new\ninstance\'s "__init__()" method will not be invoked.\n\n"__new__()" is intended mainly to allow subclasses of immutable\ntypes (like int, str, or tuple) to customize instance creation. It\nis also commonly overridden in custom metaclasses in order to\ncustomize class creation.\n\nobject.__init__(self[, ...])\n\nCalled after the instance has been created (by "__new__()"), but\nbefore it is returned to the caller. The arguments are those\npassed to the class constructor expression. If a base class has an\n"__init__()" method, the derived class\'s "__init__()" method, if\nany, must explicitly call it to ensure proper initialization of the\nbase class part of the instance; for example:\n"BaseClass.__init__(self, [args...])".\n\nBecause "__new__()" and "__init__()" work together in constructing\nobjects ("__new__()" to create it, and "__init__()" to customise\nit), no non-"None" value may be returned by "__init__()"; doing so\nwill cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\nCalled when the instance is about to be destroyed. This is also\ncalled a destructor. If a base class has a "__del__()" method, the\nderived class\'s "__del__()" method, if any, must explicitly call it\nto ensure proper deletion of the base class part of the instance.\nNote that it is possible (though not recommended!) for the\n"__del__()" method to postpone destruction of the instance by\ncreating a new reference to it. It may then be called at a later\ntime when this new reference is deleted. It is not guaranteed that\n"__del__()" methods are called for objects that still exist when\nthe interpreter exits.\n\nNote: "del x" doesn\'t directly call "x.__del__()" --- the former\ndecrements the reference count for "x" by one, and the latter is\nonly called when "x"\'s reference count reaches zero. Some common\nsituations that may prevent the reference count of an object from\ngoing to zero include: circular references between objects (e.g.,\na doubly-linked list or a tree data structure with parent and\nchild pointers); a reference to the object on the stack frame of\na function that caught an exception (the traceback stored in\n"sys.exc_traceback" keeps the stack frame alive); or a reference\nto the object on the stack frame that raised an unhandled\nexception in interactive mode (the traceback stored in\n"sys.last_traceback" keeps the stack frame alive). The first\nsituation can only be remedied by explicitly breaking the cycles;\nthe latter two situations can be resolved by storing "None" in\n"sys.exc_traceback" or "sys.last_traceback". Circular references\nwhich are garbage are detected when the option cycle detector is\nenabled (it\'s on by default), but can only be cleaned up if there\nare no Python-level "__del__()" methods involved. Refer to the\ndocumentation for the "gc" module for more information about how\n"__del__()" methods are handled by the cycle detector,\nparticularly the description of the "garbage" value.\n\nWarning: Due to the precarious circumstances under which\n"__del__()" methods are invoked, exceptions that occur during\ntheir execution are ignored, and a warning is printed to\n"sys.stderr" instead. Also, when "__del__()" is invoked in\nresponse to a module being deleted (e.g., when execution of the\nprogram is done), other globals referenced by the "__del__()"\nmethod may already have been deleted or in the process of being\ntorn down (e.g. the import machinery shutting down). For this\nreason, "__del__()" methods should do the absolute minimum needed\nto maintain external invariants. Starting with version 1.5,\nPython guarantees that globals whose name begins with a single\nunderscore are deleted from their module before other globals are\ndeleted; if no other references to such globals exist, this may\nhelp in assuring that imported modules are still available at the\ntime when the "__del__()" method is called.\n\nSee also the "-R" command-line option.\n\nobject.__repr__(self)\n\nCalled by the "repr()" built-in function and by string conversions\n(reverse quotes) to compute the "official" string representation of\nan object. If at all possible, this should look like a valid\nPython expression that could be used to recreate an object with the\nsame value (given an appropriate environment). If this is not\npossible, a string of the form "<...some useful description...>"\nshould be returned. The return value must be a string object. If a\nclass defines "__repr__()" but not "__str__()", then "__repr__()"\nis also used when an "informal" string representation of instances\nof that class is required.\n\nThis is typically used for debugging, so it is important that the\nrepresentation is information-rich and unambiguous.\n\nobject.__str__(self)\n\nCalled by the "str()" built-in function and by the "print"\nstatement to compute the "informal" string representation of an\nobject. This differs from "__repr__()" in that it does not have to\nbe a valid Python expression: a more convenient or concise\nrepresentation may be used instead. The return value must be a\nstring object.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\nNew in version 2.1.\n\nThese are the so-called "rich comparison" methods, and are called\nfor comparison operators in preference to "__cmp__()" below. The\ncorrespondence between operator symbols and method names is as\nfollows: "x<y" calls "x.__lt__(y)", "x<=y" calls "x.__le__(y)",\n"x==y" calls "x.__eq__(y)", "x!=y" and "x<>y" call "x.__ne__(y)",\n"x>y" calls "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\nA rich comparison method may return the singleton "NotImplemented"\nif it does not implement the operation for a given pair of\narguments. By convention, "False" and "True" are returned for a\nsuccessful comparison. However, these methods can return any value,\nso if the comparison operator is used in a Boolean context (e.g.,\nin the condition of an "if" statement), Python will call "bool()"\non the value to determine if the result is true or false.\n\nThere are no implied relationships among the comparison operators.\nThe truth of "x==y" does not imply that "x!=y" is false.\nAccordingly, when defining "__eq__()", one should also define\n"__ne__()" so that the operators will behave as expected. See the\nparagraph on "__hash__()" for some important notes on creating\n*hashable* objects which support custom comparison operations and\nare usable as dictionary keys.\n\nThere are no swapped-argument versions of these methods (to be used\nwhen the left argument does not support the operation but the right\nargument does); rather, "__lt__()" and "__gt__()" are each other\'s\nreflection, "__le__()" and "__ge__()" are each other\'s reflection,\nand "__eq__()" and "__ne__()" are their own reflection.\n\nArguments to rich comparison methods are never coerced.\n\nTo automatically generate ordering operations from a single root\noperation, see "functools.total_ordering()".\n\nobject.__cmp__(self, other)\n\nCalled by comparison operations if rich comparison (see above) is\nnot defined. Should return a negative integer if "self < other",\nzero if "self == other", a positive integer if "self > other". If\nno "__cmp__()", "__eq__()" or "__ne__()" operation is defined,\nclass instances are compared by object identity ("address"). See\nalso the description of "__hash__()" for some important notes on\ncreating *hashable* objects which support custom comparison\noperations and are usable as dictionary keys. (Note: the\nrestriction that exceptions are not propagated by "__cmp__()" has\nbeen removed since Python 1.5.)\n\nobject.__rcmp__(self, other)\n\nChanged in version 2.1: No longer supported.\n\nobject.__hash__(self)\n\nCalled by built-in function "hash()" and for operations on members\nof hashed collections including "set", "frozenset", and "dict".\n"__hash__()" should return an integer. The only required property\nis that objects which compare equal have the same hash value; it is\nadvised to somehow mix together (e.g. using exclusive or) the hash\nvalues for the components of the object that also play a part in\ncomparison of objects.\n\nIf a class does not define a "__cmp__()" or "__eq__()" method it\nshould not define a "__hash__()" operation either; if it defines\n"__cmp__()" or "__eq__()" but not "__hash__()", its instances will\nnot be usable in hashed collections. If a class defines mutable\nobjects and implements a "__cmp__()" or "__eq__()" method, it\nshould not implement "__hash__()", since hashable collection\nimplementations require that a object\'s hash value is immutable (if\nthe object\'s hash value changes, it will be in the wrong hash\nbucket).\n\nUser-defined classes have "__cmp__()" and "__hash__()" methods by\ndefault; with them, all objects compare unequal (except with\nthemselves) and "x.__hash__()" returns a result derived from\n"id(x)".\n\nClasses which inherit a "__hash__()" method from a parent class but\nchange the meaning of "__cmp__()" or "__eq__()" such that the hash\nvalue returned is no longer appropriate (e.g. by switching to a\nvalue-based concept of equality instead of the default identity\nbased equality) can explicitly flag themselves as being unhashable\nby setting "__hash__ = None" in the class definition. Doing so\nmeans that not only will instances of the class raise an\nappropriate "TypeError" when a program attempts to retrieve their\nhash value, but they will also be correctly identified as\nunhashable when checking "isinstance(obj, collections.Hashable)"\n(unlike classes which define their own "__hash__()" to explicitly\nraise "TypeError").\n\nChanged in version 2.5: "__hash__()" may now also return a long\ninteger object; the 32-bit integer is then derived from the hash of\nthat object.\n\nChanged in version 2.6: "__hash__" may now be set to "None" to\nexplicitly flag instances of a class as unhashable.\n\nobject.__nonzero__(self)\n\nCalled to implement truth value testing and the built-in operation\n"bool()"; should return "False" or "True", or their integer\nequivalents "0" or "1". When this method is not defined,\n"__len__()" is called, if it is defined, and the object is\nconsidered true if its result is nonzero. If a class defines\nneither "__len__()" nor "__nonzero__()", all its instances are\nconsidered true.\n\nobject.__unicode__(self)\n\nCalled to implement "unicode()" built-in; should return a Unicode\nobject. When this method is not defined, string conversion is\nattempted, and the result of string conversion is converted to\nUnicode using the system default encoding.\n',
27'debugger': u'\n"pdb" --- The Python Debugger\n*****************************\n\n**Source code:** Lib/pdb.py\n\n======================================================================\n\nThe module "pdb" defines an interactive source code debugger for\nPython programs. It supports setting (conditional) breakpoints and\nsingle stepping at the source line level, inspection of stack frames,\nsource code listing, and evaluation of arbitrary Python code in the\ncontext of any stack frame. It also supports post-mortem debugging\nand can be called under program control.\n\nThe debugger is extensible --- it is actually defined as the class\n"Pdb". This is currently undocumented but easily understood by reading\nthe source. The extension interface uses the modules "bdb" and "cmd".\n\nThe debugger\'s prompt is "(Pdb)". Typical usage to run a program under\ncontrol of the debugger is:\n\n>>> import pdb\n>>> import mymodule\n>>> pdb.run(\'mymodule.test()\')\n> <string>(0)?()\n(Pdb) continue\n> <string>(1)?()\n(Pdb) continue\nNameError:\'spam\'\n> <string>(1)?()\n(Pdb)\n\n"pdb.py" can also be invoked as a script to debug other scripts. For\nexample:\n\npython -m pdb myscript.py\n\nWhen invoked as a script, pdb will automatically enter post-mortem\ndebugging if the program being debugged exits abnormally. After post-\nmortem debugging (or after normal exit of the program), pdb will\nrestart the program. Automatic restarting preserves pdb\'s state (such\nas breakpoints) and in most cases is more useful than quitting the\ndebugger upon program\'s exit.\n\nNew in version 2.4: Restarting post-mortem behavior added.\n\nThe typical usage to break into the debugger from a running program is\nto insert\n\nimport pdb; pdb.set_trace()\n\nat the location you want to break into the debugger. You can then\nstep through the code following this statement, and continue running\nwithout the debugger using the "c" command.\n\nThe typical usage to inspect a crashed program is:\n\n>>> import pdb\n>>> import mymodule\n>>> mymodule.test()\nTraceback (most recent call last):\nFile "<stdin>", line 1, in ?\nFile "./mymodule.py", line 4, in test\ntest2()\nFile "./mymodule.py", line 3, in test2\nprint spam\nNameError: spam\n>>> pdb.pm()\n> ./mymodule.py(3)test2()\n-> print spam\n(Pdb)\n\nThe module defines the following functions; each enters the debugger\nin a slightly different way:\n\npdb.run(statement[, globals[, locals]])\n\nExecute the *statement* (given as a string) under debugger control.\nThe debugger prompt appears before any code is executed; you can\nset breakpoints and type "continue", or you can step through the\nstatement using "step" or "next" (all these commands are explained\nbelow). The optional *globals* and *locals* arguments specify the\nenvironment in which the code is executed; by default the\ndictionary of the module "__main__" is used. (See the explanation\nof the "exec" statement or the "eval()" built-in function.)\n\npdb.runeval(expression[, globals[, locals]])\n\nEvaluate the *expression* (given as a string) under debugger\ncontrol. When "runeval()" returns, it returns the value of the\nexpression. Otherwise this function is similar to "run()".\n\npdb.runcall(function[, argument, ...])\n\nCall the *function* (a function or method object, not a string)\nwith the given arguments. When "runcall()" returns, it returns\nwhatever the function call returned. The debugger prompt appears\nas soon as the function is entered.\n\npdb.set_trace()\n\nEnter the debugger at the calling stack frame. This is useful to\nhard-code a breakpoint at a given point in a program, even if the\ncode is not otherwise being debugged (e.g. when an assertion\nfails).\n\npdb.post_mortem([traceback])\n\nEnter post-mortem debugging of the given *traceback* object. If no\n*traceback* is given, it uses the one of the exception that is\ncurrently being handled (an exception must be being handled if the\ndefault is to be used).\n\npdb.pm()\n\nEnter post-mortem debugging of the traceback found in\n"sys.last_traceback".\n\nThe "run*" functions and "set_trace()" are aliases for instantiating\nthe "Pdb" class and calling the method of the same name. If you want\nto access further features, you have to do this yourself:\n\nclass class pdb.Pdb(completekey=\'tab\', stdin=None, stdout=None, skip=None)\n\n"Pdb" is the debugger class.\n\nThe *completekey*, *stdin* and *stdout* arguments are passed to the\nunderlying "cmd.Cmd" class; see the description there.\n\nThe *skip* argument, if given, must be an iterable of glob-style\nmodule name patterns. The debugger will not step into frames that\noriginate in a module that matches one of these patterns. [1]\n\nExample call to enable tracing with *skip*:\n\nimport pdb; pdb.Pdb(skip=[\'django.*\']).set_trace()\n\nNew in version 2.7: The *skip* argument.\n\nrun(statement[, globals[, locals]])\nruneval(expression[, globals[, locals]])\nruncall(function[, argument, ...])\nset_trace()\n\nSee the documentation for the functions explained above.\n',
28'del': u'\nThe "del" statement\n*******************\n\ndel_stmt ::= "del" target_list\n\nDeletion is recursively defined very similar to the way assignment is\ndefined. Rather than spelling it out in full details, here are some\nhints.\n\nDeletion of a target list recursively deletes each target, from left\nto right.\n\nDeletion of a name removes the binding of that name from the local or\nglobal namespace, depending on whether the name occurs in a "global"\nstatement in the same code block. If the name is unbound, a\n"NameError" exception will be raised.\n\nIt is illegal to delete a name from the local namespace if it occurs\nas a free variable in a nested block.\n\nDeletion of attribute references, subscriptions and slicings is passed\nto the primary object involved; deletion of a slicing is in general\nequivalent to assignment of an empty slice of the right type (but even\nthis is determined by the sliced object).\n',
29'dict': u'\nDictionary displays\n*******************\n\nA dictionary display is a possibly empty series of key/datum pairs\nenclosed in curly braces:\n\ndict_display ::= "{" [key_datum_list | dict_comprehension] "}"\nkey_datum_list ::= key_datum ("," key_datum)* [","]\nkey_datum ::= expression ":" expression\ndict_comprehension ::= expression ":" expression comp_for\n\nA dictionary display yields a new dictionary object.\n\nIf a comma-separated sequence of key/datum pairs is given, they are\nevaluated from left to right to define the entries of the dictionary:\neach key object is used as a key into the dictionary to store the\ncorresponding datum. This means that you can specify the same key\nmultiple times in the key/datum list, and the final dictionary\'s value\nfor that key will be the last one given.\n\nA dict comprehension, in contrast to list and set comprehensions,\nneeds two expressions separated with a colon followed by the usual\n"for" and "if" clauses. When the comprehension is run, the resulting\nkey and value elements are inserted in the new dictionary in the order\nthey are produced.\n\nRestrictions on the types of the key values are listed earlier in\nsection The standard type hierarchy. (To summarize, the key type\nshould be *hashable*, which excludes all mutable objects.) Clashes\nbetween duplicate keys are not detected; the last datum (textually\nrightmost in the display) stored for a given key value prevails.\n',
30'dynamic-features': u'\nInteraction with dynamic features\n*********************************\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nIf the wild card form of import --- "import *" --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a "SyntaxError".\n\nIf "exec" is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n"SyntaxError" unless the exec explicitly specifies the local namespace\nfor the "exec". (In other words, "exec obj" would be illegal, but\n"exec obj in ns" would be legal.)\n\nThe "eval()", "execfile()", and "input()" functions and the "exec"\nstatement do not have access to the full environment for resolving\nnames. Names may be resolved in the local and global namespaces of\nthe caller. Free variables are not resolved in the nearest enclosing\nnamespace, but in the global namespace. [1] The "exec" statement and\nthe "eval()" and "execfile()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n',
31'else': u'\nThe "if" statement\n******************\n\nThe "if" statement is used for conditional execution:\n\nif_stmt ::= "if" expression ":" suite\n( "elif" expression ":" suite )*\n["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section Boolean operations\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n',
32'exceptions': u'\nExceptions\n**********\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the "raise" statement. Exception\nhandlers are specified with the "try" ... "except" statement. The\n"finally" clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n"SystemExit".\n\nExceptions are identified by class instances. The "except" clause is\nselected depending on the class of the instance: it must reference the\nclass of the instance or a base class thereof. The instance can be\nreceived by the handler and can carry additional information about the\nexceptional condition.\n\nExceptions can also be identified by strings, in which case the\n"except" clause is selected by object identity. An arbitrary value\ncan be raised along with the identifying string which can be passed to\nthe handler.\n\nNote: Messages to exceptions are not part of the Python API. Their\ncontents may change from one version of Python to the next without\nwarning and should not be relied on by code which will run under\nmultiple versions of the interpreter.\n\nSee also the description of the "try" statement in section The try\nstatement and "raise" statement in section The raise statement.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by\nthese operations is not available at the time the module is\ncompiled.\n',
33'exec': u'\nThe "exec" statement\n********************\n\nexec_stmt ::= "exec" or_expr ["in" expression ["," expression]]\n\nThis statement supports dynamic execution of Python code. The first\nexpression should evaluate to either a Unicode string, a *Latin-1*\nencoded string, an open file object, a code object, or a tuple. If it\nis a string, the string is parsed as a suite of Python statements\nwhich is then executed (unless a syntax error occurs). [1] If it is an\nopen file, the file is parsed until EOF and executed. If it is a code\nobject, it is simply executed. For the interpretation of a tuple, see\nbelow. In all cases, the code that\'s executed is expected to be valid\nas file input (see section File input). Be aware that the "return"\nand "yield" statements may not be used outside of function definitions\neven within the context of code passed to the "exec" statement.\n\nIn all cases, if the optional parts are omitted, the code is executed\nin the current scope. If only the first expression after "in" is\nspecified, it should be a dictionary, which will be used for both the\nglobal and the local variables. If two expressions are given, they\nare used for the global and local variables, respectively. If\nprovided, *locals* can be any mapping object. Remember that at module\nlevel, globals and locals are the same dictionary. If two separate\nobjects are given as *globals* and *locals*, the code will be executed\nas if it were embedded in a class definition.\n\nThe first expression may also be a tuple of length 2 or 3. In this\ncase, the optional parts must be omitted. The form "exec(expr,\nglobals)" is equivalent to "exec expr in globals", while the form\n"exec(expr, globals, locals)" is equivalent to "exec expr in globals,\nlocals". The tuple form of "exec" provides compatibility with Python\n3, where "exec" is a function rather than a statement.\n\nChanged in version 2.4: Formerly, *locals* was required to be a\ndictionary.\n\nAs a side effect, an implementation may insert additional keys into\nthe dictionaries given besides those corresponding to variable names\nset by the executed code. For example, the current implementation may\nadd a reference to the dictionary of the built-in module "__builtin__"\nunder the key "__builtins__" (!).\n\n**Programmer\'s hints:** dynamic evaluation of expressions is supported\nby the built-in function "eval()". The built-in functions "globals()"\nand "locals()" return the current global and local dictionary,\nrespectively, which may be useful to pass around for use by "exec".\n\n-[ Footnotes ]-\n\n[1] Note that the parser only accepts the Unix-style end of line\nconvention. If you are reading the code from a file, make sure to\nuse *universal newlines* mode to convert Windows or Mac-style\nnewlines.\n',
34'execmodel': u'\nExecution model\n***************\n\n\nNaming and binding\n==================\n\n*Names* refer to objects. Names are introduced by name binding\noperations. Each occurrence of a name in the program text refers to\nthe *binding* of that name established in the innermost function block\ncontaining the use.\n\nA *block* is a piece of Python program text that is executed as a\nunit. The following are blocks: a module, a function body, and a class\ndefinition. Each command typed interactively is a block. A script\nfile (a file given as standard input to the interpreter or specified\non the interpreter command line the first argument) is a code block.\nA script command (a command specified on the interpreter command line\nwith the\'**-c**\'option) is a code block. The file read by the\nbuilt-in function "execfile()" is a code block. The string argument\npassed to the built-in function "eval()" and to the "exec" statement\nis a code block. The expression read and evaluated by the built-in\nfunction "input()" is a code block.\n\nA code block is executed in an *execution frame*. A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name. The scope of names defined in a\nclass block is limited to the class block; it does not extend to the\ncode blocks of methods -- this includes generator expressions since\nthey are implemented using a function scope. This means that the\nfollowing will fail:\n\nclass A:\na = 42\nb = list(a + i for i in range(10))\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nIf a name is bound in a block, it is a local variable of that block.\nIf a name is bound at the module level, it is a global variable. (The\nvariables of the module code block are local and global.) If a\nvariable is used in a code block but not defined there, it is a *free\nvariable*.\n\nWhen a name is not found at all, a "NameError" exception is raised.\nIf the name refers to a local variable that has not been bound, a\n"UnboundLocalError" exception is raised. "UnboundLocalError" is a\nsubclass of "NameError".\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, in the\nsecond position of an "except" clause header or after "as" in a "with"\nstatement. The "import" statement of the form "from ... import *"\nbinds all names defined in the imported module, except those beginning\nwith an underscore. This form may only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name). It\nis illegal to unbind a name that is referenced by an enclosing scope;\nthe compiler will report a "SyntaxError".\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the global statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "__builtin__". The global namespace is searched first.\nIf the name is not found there, the builtins namespace is searched.\nThe global statement must precede all uses of the name.\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used). By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "__builtin__" (note: no\n\'s\'); when in any other module, "__builtins__" is an alias for the\ndictionary of the "__builtin__" module itself. "__builtins__" can be\nset to a user-created dictionary to create a weak form of restricted\nexecution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail. Users\nwanting to override values in the builtins namespace should "import"\nthe "__builtin__" (no\'s\') module and modify its attributes\nappropriately.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n"__main__".\n\nThe "global" statement has the same scope as a name binding operation\nin the same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nA class definition is an executable statement that may use and define\nnames. These references follow the normal rules for name resolution.\nThe namespace of the class definition becomes the attribute dictionary\nof the class. Names defined at the class scope are not visible in\nmethods.\n\n\nInteraction with dynamic features\n---------------------------------\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nIf the wild card form of import --- "import *" --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a "SyntaxError".\n\nIf "exec" is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n"SyntaxError" unless the exec explicitly specifies the local namespace\nfor the "exec". (In other words, "exec obj" would be illegal, but\n"exec obj in ns" would be legal.)\n\nThe "eval()", "execfile()", and "input()" functions and the "exec"\nstatement do not have access to the full environment for resolving\nnames. Names may be resolved in the local and global namespaces of\nthe caller. Free variables are not resolved in the nearest enclosing\nnamespace, but in the global namespace. [1] The "exec" statement and\nthe "eval()" and "execfile()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n\n\nExceptions\n==========\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the "raise" statement. Exception\nhandlers are specified with the "try" ... "except" statement. The\n"finally" clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n"SystemExit".\n\nExceptions are identified by class instances. The "except" clause is\nselected depending on the class of the instance: it must reference the\nclass of the instance or a base class thereof. The instance can be\nreceived by the handler and can carry additional information about the\nexceptional condition.\n\nExceptions can also be identified by strings, in which case the\n"except" clause is selected by object identity. An arbitrary value\ncan be raised along with the identifying string which can be passed to\nthe handler.\n\nNote: Messages to exceptions are not part of the Python API. Their\ncontents may change from one version of Python to the next without\nwarning and should not be relied on by code which will run under\nmultiple versions of the interpreter.\n\nSee also the description of the "try" statement in section The try\nstatement and "raise" statement in section The raise statement.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by\nthese operations is not available at the time the module is\ncompiled.\n',
35'exprlists': u'\nExpression lists\n****************\n\nexpression_list ::= expression ( "," expression )* [","]\n\nAn expression list containing at least one comma yields a tuple. The\nlength of the tuple is the number of expressions in the list. The\nexpressions are evaluated from left to right.\n\nThe trailing comma is required only to create a single tuple (a.k.a. a\n*singleton*); it is optional in all other cases. A single expression\nwithout a trailing comma doesn\'t create a tuple, but rather yields the\nvalue of that expression. (To create an empty tuple, use an empty pair\nof parentheses: "()".)\n',
36'floating': u'\nFloating point literals\n***********************\n\nFloating point literals are described by the following lexical\ndefinitions:\n\nfloatnumber ::= pointfloat | exponentfloat\npointfloat ::= [intpart] fraction | intpart "."\nexponentfloat ::= (intpart | pointfloat) exponent\nintpart ::= digit+\nfraction ::= "." digit+\nexponent ::= ("e" | "E") ["+" | "-"] digit+\n\nNote that the integer and exponent parts of floating point numbers can\nlook like octal integers, but are interpreted using radix 10. For\nexample, "077e010" is legal, and denotes the same number as "77e10".\nThe allowed range of floating point literals is implementation-\ndependent. Some examples of floating point literals:\n\n3.14 10. .001 1e100 3.14e-10 0e0\n\nNote that numeric literals do not include a sign; a phrase like "-1"\nis actually an expression composed of the unary operator "-" and the\nliteral "1".\n',
37'for': u'\nThe "for" statement\n*******************\n\nThe "for" statement is used to iterate over the elements of a sequence\n(such as a string, tuple or list) or other iterable object:\n\nfor_stmt ::= "for" target_list "in" expression_list ":" suite\n["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n"expression_list". The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments, and then the suite is executed. When the items are\nexhausted (which is immediately when the sequence is empty), the suite\nin the "else" clause, if present, is executed, and the loop\nterminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and continues\nwith the next item, or with the "else" clause if there was no next\nitem.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nThe target list is not deleted when the loop is finished, but if the\nsequence is empty, it will not have been assigned to at all by the\nloop. Hint: the built-in function "range()" returns a sequence of\nintegers suitable to emulate the effect of Pascal\'s "for i := a to b\ndo"; e.g., "range(3)" returns the list "[0, 1, 2]".\n\nNote: There is a subtlety when the sequence is being modified by the\nloop (this can only occur for mutable sequences, i.e. lists). An\ninternal counter is used to keep track of which item is used next,\nand this is incremented on each iteration. When this counter has\nreached the length of the sequence the loop terminates. This means\nthat if the suite deletes the current (or a previous) item from the\nsequence, the next item will be skipped (since it gets the index of\nthe current item which has already been treated). Likewise, if the\nsuite inserts an item in the sequence before the current item, the\ncurrent item will be treated again the next time through the loop.\nThis can lead to nasty bugs that can be avoided by making a\ntemporary copy using a slice of the whole sequence, e.g.,\n\nfor x in a[:]:\nif x < 0: a.remove(x)\n',
38'formatstrings': u'\nFormat String Syntax\n********************\n\nThe "str.format()" method and the "Formatter" class share the same\nsyntax for format strings (although in the case of "Formatter",\nsubclasses can define their own format string syntax).\n\nFormat strings contain "replacement fields" surrounded by curly braces\n"{}". Anything that is not contained in braces is considered literal\ntext, which is copied unchanged to the output. If you need to include\na brace character in the literal text, it can be escaped by doubling:\n"{{" and "}}".\n\nThe grammar for a replacement field is as follows:\n\nreplacement_field ::= "{" [field_name] ["!" conversion] [":" format_spec] "}"\nfield_name ::= arg_name ("." attribute_name | "[" element_index "]")*\narg_name ::= [identifier | integer]\nattribute_name ::= identifier\nelement_index ::= integer | index_string\nindex_string ::= <any source character except "]"> +\nconversion ::= "r" | "s"\nformat_spec ::= <described in the next section>\n\nIn less formal terms, the replacement field can start with a\n*field_name* that specifies the object whose value is to be formatted\nand inserted into the output instead of the replacement field. The\n*field_name* is optionally followed by a *conversion* field, which is\npreceded by an exclamation point "\'!\'", and a *format_spec*, which is\npreceded by a colon "\':\'". These specify a non-default format for the\nreplacement value.\n\nSee also the Format Specification Mini-Language section.\n\nThe *field_name* itself begins with an *arg_name* that is either a\nnumber or a keyword. If it\'s a number, it refers to a positional\nargument, and if it\'s a keyword, it refers to a named keyword\nargument. If the numerical arg_names in a format string are 0, 1, 2,\n... in sequence, they can all be omitted (not just some) and the\nnumbers 0, 1, 2, ... will be automatically inserted in that order.\nBecause *arg_name* is not quote-delimited, it is not possible to\nspecify arbitrary dictionary keys (e.g., the strings "\'10\'" or\n"\':-]\'") within a format string. The *arg_name* can be followed by any\nnumber of index or attribute expressions. An expression of the form\n"\'.name\'" selects the named attribute using "getattr()", while an\nexpression of the form "\'[index]\'" does an index lookup using\n"__getitem__()".\n\nChanged in version 2.7: The positional argument specifiers can be\nomitted, so "\'{} {}\'" is equivalent to "\'{0} {1}\'".\n\nSome simple format string examples:\n\n"First, thou shalt count to{0}" # References first positional argument\n"Bring me a {}" # Implicitly references the first positional argument\n"From {} to {}" # Same as "From{0}to{1}"\n"My quest is{name}" # References keyword argument\'name\'\n"Weight in tons {0.weight}" #\'weight\'attribute of first positional arg\n"Units destroyed: {players[0]}" # First element of keyword argument\'players\'.\n\nThe *conversion* field causes a type coercion before formatting.\nNormally, the job of formatting a value is done by the "__format__()"\nmethod of the value itself. However, in some cases it is desirable to\nforce a type to be formatted as a string, overriding its own\ndefinition of formatting. By converting the value to a string before\ncalling "__format__()", the normal formatting logic is bypassed.\n\nTwo conversion flags are currently supported: "\'!s\'" which calls\n"str()" on the value, and "\'!r\'" which calls "repr()".\n\nSome examples:\n\n"Harold\'s a clever {0!s}" # Calls str() on the argument first\n"Bring out the holy {name!r}" # Calls repr() on the argument first\n\nThe *format_spec* field contains a specification of how the value\nshould be presented, including such details as field width, alignment,\npadding, decimal precision and so on. Each value type can define its\nown "formatting mini-language" or interpretation of the *format_spec*.\n\nMost built-in types support a common formatting mini-language, which\nis described in the next section.\n\nA *format_spec* field can also include nested replacement fields\nwithin it. These nested replacement fields can contain only a field\nname; conversion flags and format specifications are not allowed. The\nreplacement fields within the format_spec are substituted before the\n*format_spec* string is interpreted. This allows the formatting of a\nvalue to be dynamically specified.\n\nSee the Format examples section for some examples.\n\n\nFormat Specification Mini-Language\n==================================\n\n"Format specifications" are used within replacement fields contained\nwithin a format string to define how individual values are presented\n(see Format String Syntax). They can also be passed directly to the\nbuilt-in "format()" function. Each formattable type may define how\nthe format specification is to be interpreted.\n\nMost built-in types implement the following options for format\nspecifications, although some of the formatting options are only\nsupported by the numeric types.\n\nA general convention is that an empty format string ("""") produces\nthe same result as if you had called "str()" on the value. A non-empty\nformat string typically modifies the result.\n\nThe general form of a *standard format specifier* is:\n\nformat_spec ::= [[fill]align][sign][#][0][width][,][.precision][type]\nfill ::= <any character>\nalign ::= "<" | ">" | "=" | "^"\nsign ::= "+" | "-" | " "\nwidth ::= integer\nprecision ::= integer\ntype ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"\n\nIf a valid *align* value is specified, it can be preceded by a *fill*\ncharacter that can be any character and defaults to a space if\nomitted. Note that it is not possible to use "{" and "}" as *fill*\nchar while using the "str.format()" method; this limitation however\ndoesn\'t affect the "format()" function.\n\nThe meaning of the various alignment options is as follows:\n\n+-----------+------------------------------------------------------------+\n| Option | Meaning |\n+===========+============================================================+\n| "\'<\'" | Forces the field to be left-aligned within the available |\n| | space (this is the default for most objects). |\n+-----------+------------------------------------------------------------+\n| "\'>\'" | Forces the field to be right-aligned within the available |\n| | space (this is the default for numbers). |\n+-----------+------------------------------------------------------------+\n| "\'=\'" | Forces the padding to be placed after the sign (if any) |\n| | but before the digits. This is used for printing fields |\n| | in the form\'+000000120\'. This alignment option is only |\n| | valid for numeric types. |\n+-----------+------------------------------------------------------------+\n| "\'^\'" | Forces the field to be centered within the available |\n| | space. |\n+-----------+------------------------------------------------------------+\n\nNote that unless a minimum field width is defined, the field width\nwill always be the same size as the data to fill it, so that the\nalignment option has no meaning in this case.\n\nThe *sign* option is only valid for number types, and can be one of\nthe following:\n\n+-----------+------------------------------------------------------------+\n| Option | Meaning |\n+===========+============================================================+\n| "\'+\'" | indicates that a sign should be used for both positive as |\n| | well as negative numbers. |\n+-----------+------------------------------------------------------------+\n| "\'-\'" | indicates that a sign should be used only for negative |\n| | numbers (this is the default behavior). |\n+-----------+------------------------------------------------------------+\n| space | indicates that a leading space should be used on positive |\n| | numbers, and a minus sign on negative numbers. |\n+-----------+------------------------------------------------------------+\n\nThe "\'#\'" option is only valid for integers, and only for binary,\noctal, or hexadecimal output. If present, it specifies that the\noutput will be prefixed by "\'0b\'", "\'0o\'", or "\'0x\'", respectively.\n\nThe "\',\'" option signals the use of a comma for a thousands separator.\nFor a locale aware separator, use the "\'n\'" integer presentation type\ninstead.\n\nChanged in version 2.7: Added the "\',\'" option (see also **PEP 378**).\n\n*width* is a decimal integer defining the minimum field width. If not\nspecified, then the field width will be determined by the content.\n\nPreceding the *width* field by a zero ("\'0\'") character enables sign-\naware zero-padding for numeric types. This is equivalent to a *fill*\ncharacter of "\'0\'" with an *alignment* type of "\'=\'".\n\nThe *precision* is a decimal number indicating how many digits should\nbe displayed after the decimal point for a floating point value\nformatted with "\'f\'" and "\'F\'", or before and after the decimal point\nfor a floating point value formatted with "\'g\'" or "\'G\'". For non-\nnumber types the field indicates the maximum field size - in other\nwords, how many characters will be used from the field content. The\n*precision* is not allowed for integer values.\n\nFinally, the *type* determines how the data should be presented.\n\nThe available string presentation types are:\n\n+-----------+------------------------------------------------------------+\n| Type | Meaning |\n+===========+============================================================+\n| "\'s\'" | String format. This is the default type for strings and |\n| | may be omitted. |\n+-----------+------------------------------------------------------------+\n| None | The same as "\'s\'". |\n+-----------+------------------------------------------------------------+\n\nThe available integer presentation types are:\n\n+-----------+------------------------------------------------------------+\n| Type | Meaning |\n+===========+============================================================+\n| "\'b\'" | Binary format. Outputs the number in base 2. |\n+-----------+------------------------------------------------------------+\n| "\'c\'" | Character. Converts the integer to the corresponding |\n| | unicode character before printing. |\n+-----------+------------------------------------------------------------+\n| "\'d\'" | Decimal Integer. Outputs the number in base 10. |\n+-----------+------------------------------------------------------------+\n| "\'o\'" | Octal format. Outputs the number in base 8. |\n+-----------+------------------------------------------------------------+\n| "\'x\'" | Hex format. Outputs the number in base 16, using lower- |\n| | case letters for the digits above 9. |\n+-----------+------------------------------------------------------------+\n| "\'X\'" | Hex format. Outputs the number in base 16, using upper- |\n| | case letters for the digits above 9. |\n+-----------+------------------------------------------------------------+\n| "\'n\'" | Number. This is the same as "\'d\'", except that it uses the |\n| | current locale setting to insert the appropriate number |\n| | separator characters. |\n+-----------+------------------------------------------------------------+\n| None | The same as "\'d\'". |\n+-----------+------------------------------------------------------------+\n\nIn addition to the above presentation types, integers can be formatted\nwith the floating point presentation types listed below (except "\'n\'"\nand None). When doing so, "float()" is used to convert the integer to\na floating point number before formatting.\n\nThe available presentation types for floating point and decimal values\nare:\n\n+-----------+------------------------------------------------------------+\n| Type | Meaning |\n+===========+============================================================+\n| "\'e\'" | Exponent notation. Prints the number in scientific |\n| | notation using the letter\'e\'to indicate the exponent. |\n| | The default precision is "6". |\n+-----------+------------------------------------------------------------+\n| "\'E\'" | Exponent notation. Same as "\'e\'" except it uses an upper |\n| | case\'E\'as the separator character. |\n+-----------+------------------------------------------------------------+\n| "\'f\'" | Fixed point. Displays the number as a fixed-point number. |\n| | The default precision is "6". |\n+-----------+------------------------------------------------------------+\n| "\'F\'" | Fixed point. Same as "\'f\'". |\n+-----------+------------------------------------------------------------+\n| "\'g\'" | General format. For a given precision "p >= 1", this |\n| | rounds the number to "p" significant digits and then |\n| | formats the result in either fixed-point format or in |\n| | scientific notation, depending on its magnitude. The |\n| | precise rules are as follows: suppose that the result |\n| | formatted with presentation type "\'e\'" and precision "p-1" |\n| | would have exponent "exp". Then if "-4 <= exp < p", the |\n| | number is formatted with presentation type "\'f\'" and |\n| | precision "p-1-exp". Otherwise, the number is formatted |\n| | with presentation type "\'e\'" and precision "p-1". In both |\n| | cases insignificant trailing zeros are removed from the |\n| | significand, and the decimal point is also removed if |\n| | there are no remaining digits following it. Positive and |\n| | negative infinity, positive and negative zero, and nans, |\n| | are formatted as "inf", "-inf", "0", "-0" and "nan" |\n| | respectively, regardless of the precision. A precision of |\n| | "0" is treated as equivalent to a precision of "1". The |\n| | default precision is "6". |\n+-----------+------------------------------------------------------------+\n| "\'G\'" | General format. Same as "\'g\'" except switches to "\'E\'" if |\n| | the number gets too large. The representations of infinity |\n| | and NaN are uppercased, too. |\n+-----------+------------------------------------------------------------+\n| "\'n\'" | Number. This is the same as "\'g\'", except that it uses the |\n| | current locale setting to insert the appropriate number |\n| | separator characters. |\n+-----------+------------------------------------------------------------+\n| "\'%\'" | Percentage. Multiplies the number by 100 and displays in |\n| | fixed ("\'f\'") format, followed by a percent sign. |\n+-----------+------------------------------------------------------------+\n| None | The same as "\'g\'". |\n+-----------+------------------------------------------------------------+\n\n\nFormat examples\n===============\n\nThis section contains examples of the new format syntax and comparison\nwith the old "%"-formatting.\n\nIn most of the cases the syntax is similar to the old "%"-formatting,\nwith the addition of the "{}" and with ":" used instead of "%". For\nexample, "\'%03.2f\'" can be translated to "\'{:03.2f}\'".\n\nThe new format syntax also supports new and different options, shown\nin the follow examples.\n\nAccessing arguments by position:\n\n>>>\'{0},{1},{2}\'.format(\'a\',\'b\',\'c\')\n \'a, b, c\'\n>>>\'{}, {}, {}\'.format(\'a\',\'b\',\'c\') # 2.7+ only\n \'a, b, c\'\n>>>\'{2},{1},{0}\'.format(\'a\',\'b\',\'c\')\n \'c, b, a\'\n>>>\'{2},{1},{0}\'.format(*\'abc\') # unpacking argument sequence\n \'c, b, a\'\n>>>\'{0}{1}{0}\'.format(\'abra\',\'cad\') # arguments\'indices can be repeated\n \'abracadabra\'\n\nAccessing arguments by name:\n\n>>>\'Coordinates:{latitude},{longitude}\'.format(latitude=\'37.24N\', longitude=\'-115.81W\')\n \'Coordinates: 37.24N, -115.81W\'\n>>> coord = {\'latitude\':\'37.24N\',\'longitude\':\'-115.81W\'}\n>>>\'Coordinates:{latitude},{longitude}\'.format(**coord)\n \'Coordinates: 37.24N, -115.81W\'\n\nAccessing arguments\'attributes:\n\n>>> c = 3-5j\n>>> (\'The complex number{0}is formed from the real part {0.real}\'\n...\'and the imaginary part {0.imag}.\').format(c)\n \'The complex number (3-5j) is formed from the real part 3.0 and the imaginary part -5.0.\'\n>>> class Point(object):\n... def __init__(self, x, y):\n... self.x, self.y = x, y\n... def __str__(self):\n... return\'Point({self.x}, {self.y})\'.format(self=self)\n...\n>>> str(Point(4, 2))\n \'Point(4, 2)\'\n\nAccessing arguments\'items:\n\n>>> coord = (3, 5)\n>>>\'X: {0[0]}; Y: {0[1]}\'.format(coord)\n \'X: 3; Y: 5\'\n\nReplacing "%s" and "%r":\n\n>>> "repr() shows quotes: {!r}; str() doesn\'t: {!s}".format(\'test1\',\'test2\')\n"repr() shows quotes:\'test1\'; str() doesn\'t: test2"\n\nAligning the text and specifying a width:\n\n>>>\'{:<30}\'.format(\'left aligned\')\n \'left aligned\'\n>>>\'{:>30}\'.format(\'right aligned\')\n \'right aligned\'\n>>>\'{:^30}\'.format(\'centered\')\n \'centered\'\n>>>\'{:*^30}\'.format(\'centered\') # use\'*\'as a fill char\n \'***********centered***********\'\n\nReplacing "%+f", "%-f", and "% f" and specifying a sign:\n\n>>>\'{:+f}; {:+f}\'.format(3.14, -3.14) # show it always\n \'+3.140000; -3.140000\'\n>>>\'{: f}; {: f}\'.format(3.14, -3.14) # show a space for positive numbers\n \'3.140000; -3.140000\'\n>>>\'{:-f}; {:-f}\'.format(3.14, -3.14) # show only the minus -- same as\'{:f}; {:f}\'\n \'3.140000; -3.140000\'\n\nReplacing "%x" and "%o" and converting the value to different bases:\n\n>>> # format also supports binary numbers\n>>> "int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}".format(42)\n \'int: 42; hex: 2a; oct: 52; bin: 101010\'\n>>> # with 0x, 0o, or 0b as prefix:\n>>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}".format(42)\n \'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010\'\n\nUsing the comma as a thousands separator:\n\n>>>\'{:,}\'.format(1234567890)\n \'1,234,567,890\'\n\nExpressing a percentage:\n\n>>> points = 19.5\n>>> total = 22\n>>>\'Correct answers: {:.2%}\'.format(points/total)\n \'Correct answers: 88.64%\'\n\nUsing type-specific formatting:\n\n>>> import datetime\n>>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n>>>\'{:%Y-%m-%d%H:%M:%S}\'.format(d)\n \'2010-07-04 12:15:58\'\n\nNesting arguments and more complex examples:\n\n>>> for align, text in zip(\'<^>\', [\'left\',\'center\',\'right\']):\n...\'{0:{fill}{align}16}\'.format(text, fill=align, align=align)\n...\n \'left<<<<<<<<<<<<\'\n \'^^^^^center^^^^^\'\n \'>>>>>>>>>>>right\'\n>>>\n>>> octets = [192, 168, 0, 1]\n>>>\'{:02X}{:02X}{:02X}{:02X}\'.format(*octets)\n \'C0A80001\'\n>>> int(_, 16)\n3232235521\n>>>\n>>> width = 5\n>>> for num in range(5,12):\n... for base in\'dXob\':\n... print\'{0:{width}{base}}\'.format(num, base=base, width=width),\n... print\n...\n5 5 5 101\n6 6 6 110\n7 7 7 111\n8 8 10 1000\n9 9 11 1001\n10 A 12 1010\n11 B 13 1011\n',
39'function': u'\nFunction definitions\n********************\n\nA function definition defines a user-defined function object (see\nsection The standard type hierarchy):\n\ndecorated ::= decorators (classdef | funcdef)\ndecorators ::= decorator+\ndecorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\nfuncdef ::= "def" funcname "(" [parameter_list] ")" ":" suite\ndotted_name ::= identifier ("." identifier)*\nparameter_list ::= (defparameter ",")*\n( "*" identifier ["," "**" identifier]\n| "**" identifier\n| defparameter [","] )\ndefparameter ::= parameter ["=" expression]\nsublist ::= parameter ("," parameter)* [","]\nparameter ::= identifier | "(" sublist ")"\nfuncname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code:\n\n@f1(arg)\n@f2\ndef func(): pass\n\nis equivalent to:\n\ndef func(): pass\nfunc = f1(arg)(f2(func))\n\nWhen one or more top-level *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters must also have a default value --- this is a syntactic\nrestriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that the same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use "None" as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\ndef whats_on_the_telly(penguin=None):\nif penguin is None:\npenguin = []\npenguin.append("property of the zoo")\nreturn penguin\n\nFunction call semantics are described in more detail in section Calls.\nA function call always assigns values to all parameters mentioned in\nthe parameter list, either from position arguments, from keyword\narguments, or from default values. If the form ""*identifier"" is\npresent, it is initialized to a tuple receiving any excess positional\nparameters, defaulting to the empty tuple. If the form\n""**identifier"" is present, it is initialized to a new dictionary\nreceiving any excess keyword arguments, defaulting to a new empty\ndictionary.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda\nexpressions, described in section Lambdas. Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression. The ""def"" form is actually more powerful since it\nallows the execution of multiple statements.\n\n**Programmer\'s note:** Functions are first-class objects. A ""def""\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section Naming and binding for details.\n',
40'global': u'\nThe "global" statement\n**********************\n\nglobal_stmt ::= "global" identifier ("," identifier)*\n\nThe "global" statement is a declaration which holds for the entire\ncurrent code block. It means that the listed identifiers are to be\ninterpreted as globals. It would be impossible to assign to a global\nvariable without "global", although free variables may refer to\nglobals without being declared global.\n\nNames listed in a "global" statement must not be used in the same code\nblock textually preceding that "global" statement.\n\nNames listed in a "global" statement must not be defined as formal\nparameters or in a "for" loop control target, "class" definition,\nfunction definition, or "import" statement.\n\n**CPython implementation detail:** The current implementation does not\nenforce the latter two restrictions, but programs should not abuse\nthis freedom, as future implementations may enforce them or silently\nchange the meaning of the program.\n\n**Programmer\'s note:** the "global" is a directive to the parser. It\napplies only to code parsed at the same time as the "global"\nstatement. In particular, a "global" statement contained in an "exec"\nstatement does not affect the code block *containing* the "exec"\nstatement, and code contained in an "exec" statement is unaffected by\n"global" statements in the code containing the "exec" statement. The\nsame applies to the "eval()", "execfile()" and "compile()" functions.\n',
41'id-classes': u'\nReserved classes of identifiers\n*******************************\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n"_*"\nNot imported by "from module import *". The special identifier "_"\nis used in the interactive interpreter to store the result of the\nlast evaluation; it is stored in the "__builtin__" module. When\nnot in interactive mode, "_" has no special meaning and is not\ndefined. See section The import statement.\n\nNote: The name "_" is often used in conjunction with\ninternationalization; refer to the documentation for the\n"gettext" module for more information on this convention.\n\n"__*__"\nSystem-defined names. These names are defined by the interpreter\nand its implementation (including the standard library). Current\nsystem names are discussed in the Special method names section and\nelsewhere. More will likely be defined in future versions of\nPython. *Any* use of "__*__" names, in any context, that does not\nfollow explicitly documented use, is subject to breakage without\nwarning.\n\n"__*"\nClass-private names. Names in this category, when used within the\ncontext of a class definition, are re-written to use a mangled form\nto help avoid name clashes between "private" attributes of base and\nderived classes. See section Identifiers (Names).\n',
42'identifiers': u'\nIdentifiers and keywords\n************************\n\nIdentifiers (also referred to as *names*) are described by the\nfollowing lexical definitions:\n\nidentifier ::= (letter|"_") (letter | digit | "_")*\nletter ::= lowercase | uppercase\nlowercase ::= "a"..."z"\nuppercase ::= "A"..."Z"\ndigit ::= "0"..."9"\n\nIdentifiers are unlimited in length. Case is significant.\n\n\nKeywords\n========\n\nThe following identifiers are used as reserved words, or *keywords* of\nthe language, and cannot be used as ordinary identifiers. They must\nbe spelled exactly as written here:\n\nand del from not while\nas elif global or with\nassert else if pass yield\nbreak except import print\nclass exec in raise\ncontinue finally is return\ndef for lambda try\n\nChanged in version 2.4: "None" became a constant and is now recognized\nby the compiler as a name for the built-in object "None". Although it\nis not a keyword, you cannot assign a different object to it.\n\nChanged in version 2.5: Using "as" and "with" as identifiers triggers\na warning. To use them as keywords, enable the "with_statement"\nfuture feature .\n\nChanged in version 2.6: "as" and "with" are full keywords.\n\n\nReserved classes of identifiers\n===============================\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n"_*"\nNot imported by "from module import *". The special identifier "_"\nis used in the interactive interpreter to store the result of the\nlast evaluation; it is stored in the "__builtin__" module. When\nnot in interactive mode, "_" has no special meaning and is not\ndefined. See section The import statement.\n\nNote: The name "_" is often used in conjunction with\ninternationalization; refer to the documentation for the\n"gettext" module for more information on this convention.\n\n"__*__"\nSystem-defined names. These names are defined by the interpreter\nand its implementation (including the standard library). Current\nsystem names are discussed in the Special method names section and\nelsewhere. More will likely be defined in future versions of\nPython. *Any* use of "__*__" names, in any context, that does not\nfollow explicitly documented use, is subject to breakage without\nwarning.\n\n"__*"\nClass-private names. Names in this category, when used within the\ncontext of a class definition, are re-written to use a mangled form\nto help avoid name clashes between "private" attributes of base and\nderived classes. See section Identifiers (Names).\n',
43'if': u'\nThe "if" statement\n******************\n\nThe "if" statement is used for conditional execution:\n\nif_stmt ::= "if" expression ":" suite\n( "elif" expression ":" suite )*\n["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section Boolean operations\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n',
44'imaginary': u'\nImaginary literals\n******************\n\nImaginary literals are described by the following lexical definitions:\n\nimagnumber ::= (floatnumber | intpart) ("j" | "J")\n\nAn imaginary literal yields a complex number with a real part of 0.0.\nComplex numbers are represented as a pair of floating point numbers\nand have the same restrictions on their range. To create a complex\nnumber with a nonzero real part, add a floating point number to it,\ne.g., "(3+4j)". Some examples of imaginary literals:\n\n3.14j 10.j 10j .001j 1e100j 3.14e-10j\n',
45'import': u'\nThe "import" statement\n**********************\n\nimport_stmt ::= "import" module ["as" name] ( "," module ["as" name] )*\n| "from" relative_module "import" identifier ["as" name]\n( "," identifier ["as" name] )*\n| "from" relative_module "import" "(" identifier ["as" name]\n( "," identifier ["as" name] )* [","] ")"\n| "from" module "import" "*"\nmodule ::= (identifier ".")* identifier\nrelative_module ::= "."* module | "."+\nname ::= identifier\n\nImport statements are executed in two steps: (1) find a module, and\ninitialize it if necessary; (2) define a name or names in the local\nnamespace (of the scope where the "import" statement occurs). The\nstatement comes in two forms differing on whether it uses the "from"\nkeyword. The first form (without "from") repeats these steps for each\nidentifier in the list. The form with "from" performs step (1) once,\nand then performs step (2) repeatedly.\n\nTo understand how step (1) occurs, one must first understand how\nPython handles hierarchical naming of modules. To help organize\nmodules and provide a hierarchy in naming, Python has a concept of\npackages. A package can contain other packages and modules while\nmodules cannot contain other modules or packages. From a file system\nperspective, packages are directories and modules are files.\n\nOnce the name of the module is known (unless otherwise specified, the\nterm "module" will refer to both packages and modules), searching for\nthe module or package can begin. The first place checked is\n"sys.modules", the cache of all modules that have been imported\npreviously. If the module is found there then it is used in step (2)\nof import.\n\nIf the module is not found in the cache, then "sys.meta_path" is\nsearched (the specification for "sys.meta_path" can be found in **PEP\n302**). The object is a list of *finder* objects which are queried in\norder as to whether they know how to load the module by calling their\n"find_module()" method with the name of the module. If the module\nhappens to be contained within a package (as denoted by the existence\nof a dot in the name), then a second argument to "find_module()" is\ngiven as the value of the "__path__" attribute from the parent package\n(everything up to the last dot in the name of the module being\nimported). If a finder can find the module it returns a *loader*\n(discussed later) or returns "None".\n\nIf none of the finders on "sys.meta_path" are able to find the module\nthen some implicitly defined finders are queried. Implementations of\nPython vary in what implicit meta path finders are defined. The one\nthey all do define, though, is one that handles "sys.path_hooks",\n"sys.path_importer_cache", and "sys.path".\n\nThe implicit finder searches for the requested module in the "paths"\nspecified in one of two places ("paths" do not have to be file system\npaths). If the module being imported is supposed to be contained\nwithin a package then the second argument passed to "find_module()",\n"__path__" on the parent package, is used as the source of paths. If\nthe module is not contained in a package then "sys.path" is used as\nthe source of paths.\n\nOnce the source of paths is chosen it is iterated over to find a\nfinder that can handle that path. The dict at\n"sys.path_importer_cache" caches finders for paths and is checked for\na finder. If the path does not have a finder cached then\n"sys.path_hooks" is searched by calling each object in the list with a\nsingle argument of the path, returning a finder or raises\n"ImportError". If a finder is returned then it is cached in\n"sys.path_importer_cache" and then used for that path entry. If no\nfinder can be found but the path exists then a value of "None" is\nstored in "sys.path_importer_cache" to signify that an implicit, file-\nbased finder that handles modules stored as individual files should be\nused for that path. If the path does not exist then a finder which\nalways returns "None" is placed in the cache for the path.\n\nIf no finder can find the module then "ImportError" is raised.\nOtherwise some finder returned a loader whose "load_module()" method\nis called with the name of the module to load (see **PEP 302** for the\noriginal definition of loaders). A loader has several responsibilities\nto perform on a module it loads. First, if the module already exists\nin "sys.modules" (a possibility if the loader is called outside of the\nimport machinery) then it is to use that module for initialization and\nnot a new module. But if the module does not exist in "sys.modules"\nthen it is to be added to that dict before initialization begins. If\nan error occurs during loading of the module and it was added to\n"sys.modules" it is to be removed from the dict. If an error occurs\nbut the module was already in "sys.modules" it is left in the dict.\n\nThe loader must set several attributes on the module. "__name__" is to\nbe set to the name of the module. "__file__" is to be the "path" to\nthe file unless the module is built-in (and thus listed in\n"sys.builtin_module_names") in which case the attribute is not set. If\nwhat is being imported is a package then "__path__" is to be set to a\nlist of paths to be searched when looking for modules and packages\ncontained within the package being imported. "__package__" is optional\nbut should be set to the name of package that contains the module or\npackage (the empty string is used for module not contained in a\npackage). "__loader__" is also optional but should be set to the\nloader object that is loading the module.\n\nIf an error occurs during loading then the loader raises "ImportError"\nif some other exception is not already being propagated. Otherwise the\nloader returns the module that was loaded and initialized.\n\nWhen step (1) finishes without raising an exception, step (2) can\nbegin.\n\nThe first form of "import" statement binds the module name in the\nlocal namespace to the module object, and then goes on to import the\nnext identifier, if any. If the module name is followed by "as", the\nname following "as" is used as the local name for the module.\n\nThe "from" form does not bind the module name: it goes through the\nlist of identifiers, looks each one of them up in the module found in\nstep (1), and binds the name in the local namespace to the object thus\nfound. As with the first form of "import", an alternate local name\ncan be supplied by specifying ""as" localname". If a name is not\nfound, "ImportError" is raised. If the list of identifiers is\nreplaced by a star ("\'*\'"), all public names defined in the module are\nbound in the local namespace of the "import" statement..\n\nThe *public names* defined by a module are determined by checking the\nmodule\'s namespace for a variable named "__all__"; if defined, it must\nbe a sequence of strings which are names defined or imported by that\nmodule. The names given in "__all__" are all considered public and\nare required to exist. If "__all__" is not defined, the set of public\nnames includes all names found in the module\'s namespace which do not\nbegin with an underscore character ("\'_\'"). "__all__" should contain\nthe entire public API. It is intended to avoid accidentally exporting\nitems that are not part of the API (such as library modules which were\nimported and used within the module).\n\nThe "from" form with "*" may only occur in a module scope. If the\nwild card form of import --- "import *" --- is used in a function and\nthe function contains or is a nested block with free variables, the\ncompiler will raise a "SyntaxError".\n\nWhen specifying what module to import you do not have to specify the\nabsolute name of the module. When a module or package is contained\nwithin another package it is possible to make a relative import within\nthe same top package without having to mention the package name. By\nusing leading dots in the specified module or package after "from" you\ncan specify how high to traverse up the current package hierarchy\nwithout specifying exact names. One leading dot means the current\npackage where the module making the import exists. Two dots means up\none package level. Three dots is up two levels, etc. So if you execute\n"from . import mod" from a module in the "pkg" package then you will\nend up importing "pkg.mod". If you execute "from ..subpkg2 import mod"\nfrom within "pkg.subpkg1" you will import "pkg.subpkg2.mod". The\nspecification for relative imports is contained within **PEP 328**.\n\n"importlib.import_module()" is provided to support applications that\ndetermine which modules need to be loaded dynamically.\n\n\nFuture statements\n=================\n\nA *future statement* is a directive to the compiler that a particular\nmodule should be compiled using syntax or semantics that will be\navailable in a specified future release of Python. The future\nstatement is intended to ease migration to future versions of Python\nthat introduce incompatible changes to the language. It allows use of\nthe new features on a per-module basis before the release in which the\nfeature becomes standard.\n\nfuture_statement ::= "from" "__future__" "import" feature ["as" name]\n("," feature ["as" name])*\n| "from" "__future__" "import" "(" feature ["as" name]\n("," feature ["as" name])* [","] ")"\nfeature ::= identifier\nname ::= identifier\n\nA future statement must appear near the top of the module. The only\nlines that can appear before a future statement are:\n\n* the module docstring (if any),\n\n* comments,\n\n* blank lines, and\n\n* other future statements.\n\nThe features recognized by Python 2.6 are "unicode_literals",\n"print_function", "absolute_import", "division", "generators",\n"nested_scopes" and "with_statement". "generators", "with_statement",\n"nested_scopes" are redundant in Python version 2.6 and above because\nthey are always enabled.\n\nA future statement is recognized and treated specially at compile\ntime: Changes to the semantics of core constructs are often\nimplemented by generating different code. It may even be the case\nthat a new feature introduces new incompatible syntax (such as a new\nreserved word), in which case the compiler may need to parse the\nmodule differently. Such decisions cannot be pushed off until\nruntime.\n\nFor any given release, the compiler knows which feature names have\nbeen defined, and raises a compile-time error if a future statement\ncontains a feature not known to it.\n\nThe direct runtime semantics are the same as for any import statement:\nthere is a standard module "__future__", described later, and it will\nbe imported in the usual way at the time the future statement is\nexecuted.\n\nThe interesting runtime semantics depend on the specific feature\nenabled by the future statement.\n\nNote that there is nothing special about the statement:\n\nimport __future__ [as name]\n\nThat is not a future statement; it\'s an ordinary import statement with\nno special semantics or syntax restrictions.\n\nCode compiled by an "exec" statement or calls to the built-in\nfunctions "compile()" and "execfile()" that occur in a module "M"\ncontaining a future statement will, by default, use the new syntax or\nsemantics associated with the future statement. This can, starting\nwith Python 2.2 be controlled by optional arguments to "compile()" ---\nsee the documentation of that function for details.\n\nA future statement typed at an interactive interpreter prompt will\ntake effect for the rest of the interpreter session. If an\ninterpreter is started with the "-i" option, is passed a script name\nto execute, and the script includes a future statement, it will be in\neffect in the interactive session started after the script is\nexecuted.\n\nSee also: **PEP 236** - Back to the __future__\n\nThe original proposal for the __future__ mechanism.\n',
46'in': u'\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like "a < b < c" have the\ninterpretation that is conventional in mathematics:\n\ncomparison ::= or_expr ( comp_operator or_expr )*\ncomp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | "!="\n| "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: "True" or "False".\n\nComparisons can be chained arbitrarily, e.g., "x < y <= z" is\nequivalent to "x < y and y <= z", except that "y" is evaluated only\nonce (but in both cases "z" is not evaluated at all when "x < y" is\nfound to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... y\nopN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except\nthat each expression is evaluated at most once.\n\nNote that "a op1 b op2 c" doesn\'t imply any kind of comparison between\n*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\nperhaps not pretty).\n\nThe forms "<>" and "!=" are equivalent; for consistency with C, "!="\nis preferred; where "!=" is mentioned below "<>" is also accepted.\nThe "<>" spelling is considered obsolescent.\n\nThe operators "<", ">", "==", ">=", "<=", and "!=" compare the values\nof two objects. The objects need not have the same type. If both are\nnumbers, they are converted to a common type. Otherwise, objects of\ndifferent types *always* compare unequal, and are ordered consistently\nbut arbitrarily. You can control comparison behavior of objects of\nnon-built-in types by defining a "__cmp__" method or rich comparison\nmethods like "__gt__", described in section Special method names.\n\n(This unusual definition of comparison was used to simplify the\ndefinition of operations like sorting and the "in" and "not in"\noperators. In the future, the comparison rules for objects of\ndifferent types are likely to change.)\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* Strings are compared lexicographically using the numeric\nequivalents (the result of the built-in function "ord()") of their\ncharacters. Unicode and 8-bit strings are fully interoperable in\nthis behavior. [4]\n\n* Tuples and lists are compared lexicographically using comparison\nof corresponding elements. This means that to compare equal, each\nelement must compare equal and the two sequences must be of the same\ntype and have the same length.\n\nIf not equal, the sequences are ordered the same as their first\ndiffering elements. For example, "cmp([1,2,x], [1,2,y])" returns\nthe same as "cmp(x,y)". If the corresponding element does not\nexist, the shorter sequence is ordered first (for example, "[1,2] <\n[1,2,3]").\n\n* Mappings (dictionaries) compare equal if and only if their sorted\n(key, value) lists compare equal. [5] Outcomes other than equality\nare resolved consistently, but are not otherwise defined. [6]\n\n* Most other objects of built-in types compare unequal unless they\nare the same object; the choice whether one object is considered\nsmaller or larger than another one is made arbitrarily but\nconsistently within one execution of a program.\n\nThe operators "in" and "not in" test for collection membership. "x in\ns" evaluates to true if *x* is a member of the collection *s*, and\nfalse otherwise. "x not in s" returns the negation of "x in s". The\ncollection membership test has traditionally been bound to sequences;\nan object is a member of a collection if the collection is a sequence\nand contains an element equal to that object. However, it make sense\nfor many other object types to support membership tests without being\na sequence. In particular, dictionaries (for keys) and sets support\nmembership testing.\n\nFor the list and tuple types, "x in y" is true if and only if there\nexists an index *i* such that "x == y[i]" is true.\n\nFor the Unicode and string types, "x in y" is true if and only if *x*\nis a substring of *y*. An equivalent test is "y.find(x) != -1".\nNote, *x* and *y* need not be the same type; consequently, "u\'ab\'in\n\'abc\'" will return "True". Empty strings are always considered to be a\nsubstring of any other string, so """ in "abc"" will return "True".\n\nChanged in version 2.3: Previously, *x* was required to be a string of\nlength "1".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" is true if and only if "y.__contains__(x)" is true.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is true if some value "z" with "x == z"\nis produced while iterating over "y". If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is true if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n\nThe operators "is" and "is not" test for object identity: "x is y" is\ntrue if and only if *x* and *y* are the same object. "x is not y"\nyields the inverse truth value. [7]\n',
47'integers': u'\nInteger and long integer literals\n*********************************\n\nInteger and long integer literals are described by the following\nlexical definitions:\n\nlonginteger ::= integer ("l" | "L")\ninteger ::= decimalinteger | octinteger | hexinteger | bininteger\ndecimalinteger ::= nonzerodigit digit* | "0"\noctinteger ::= "0" ("o" | "O") octdigit+ | "0" octdigit+\nhexinteger ::= "0" ("x" | "X") hexdigit+\nbininteger ::= "0" ("b" | "B") bindigit+\nnonzerodigit ::= "1"..."9"\noctdigit ::= "0"..."7"\nbindigit ::= "0" | "1"\nhexdigit ::= digit | "a"..."f" | "A"..."F"\n\nAlthough both lower case "\'l\'" and upper case "\'L\'" are allowed as\nsuffix for long integers, it is strongly recommended to always use\n"\'L\'", since the letter "\'l\'" looks too much like the digit "\'1\'".\n\nPlain integer literals that are above the largest representable plain\ninteger (e.g., 2147483647 when using 32-bit arithmetic) are accepted\nas if they were long integers instead. [1] There is no limit for long\ninteger literals apart from what can be stored in available memory.\n\nSome examples of plain integer literals (first row) and long integer\nliterals (second and third rows):\n\n7 2147483647 0177\n3L 79228162514264337593543950336L 0377L 0x100000000L\n79228162514264337593543950336 0xdeadbeef\n',
48'lambda': u'\nLambdas\n*******\n\nlambda_expr ::= "lambda" [parameter_list]: expression\nold_lambda_expr ::= "lambda" [parameter_list]: old_expression\n\nLambda expressions (sometimes called lambda forms) have the same\nsyntactic position as expressions. They are a shorthand to create\nanonymous functions; the expression "lambda arguments: expression"\nyields a function object. The unnamed object behaves like a function\nobject defined with\n\ndef name(arguments):\nreturn expression\n\nSee section Function definitions for the syntax of parameter lists.\nNote that functions created with lambda expressions cannot contain\nstatements.\n',
49'lists': u'\nList displays\n*************\n\nA list display is a possibly empty series of expressions enclosed in\nsquare brackets:\n\nlist_display ::= "[" [expression_list | list_comprehension] "]"\nlist_comprehension ::= expression list_for\nlist_for ::= "for" target_list "in" old_expression_list [list_iter]\nold_expression_list ::= old_expression [("," old_expression)+ [","]]\nold_expression ::= or_test | old_lambda_expr\nlist_iter ::= list_for | list_if\nlist_if ::= "if" old_expression [list_iter]\n\nA list display yields a new list object. Its contents are specified\nby providing either a list of expressions or a list comprehension.\nWhen a comma-separated list of expressions is supplied, its elements\nare evaluated from left to right and placed into the list object in\nthat order. When a list comprehension is supplied, it consists of a\nsingle expression followed by at least one "for" clause and zero or\nmore "for" or "if" clauses. In this case, the elements of the new\nlist are those that would be produced by considering each of the "for"\nor "if" clauses a block, nesting from left to right, and evaluating\nthe expression to produce a list element each time the innermost block\nis reached [1].\n',
50'naming': u'\nNaming and binding\n******************\n\n*Names* refer to objects. Names are introduced by name binding\noperations. Each occurrence of a name in the program text refers to\nthe *binding* of that name established in the innermost function block\ncontaining the use.\n\nA *block* is a piece of Python program text that is executed as a\nunit. The following are blocks: a module, a function body, and a class\ndefinition. Each command typed interactively is a block. A script\nfile (a file given as standard input to the interpreter or specified\non the interpreter command line the first argument) is a code block.\nA script command (a command specified on the interpreter command line\nwith the\'**-c**\'option) is a code block. The file read by the\nbuilt-in function "execfile()" is a code block. The string argument\npassed to the built-in function "eval()" and to the "exec" statement\nis a code block. The expression read and evaluated by the built-in\nfunction "input()" is a code block.\n\nA code block is executed in an *execution frame*. A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name. The scope of names defined in a\nclass block is limited to the class block; it does not extend to the\ncode blocks of methods -- this includes generator expressions since\nthey are implemented using a function scope. This means that the\nfollowing will fail:\n\nclass A:\na = 42\nb = list(a + i for i in range(10))\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nIf a name is bound in a block, it is a local variable of that block.\nIf a name is bound at the module level, it is a global variable. (The\nvariables of the module code block are local and global.) If a\nvariable is used in a code block but not defined there, it is a *free\nvariable*.\n\nWhen a name is not found at all, a "NameError" exception is raised.\nIf the name refers to a local variable that has not been bound, a\n"UnboundLocalError" exception is raised. "UnboundLocalError" is a\nsubclass of "NameError".\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, in the\nsecond position of an "except" clause header or after "as" in a "with"\nstatement. The "import" statement of the form "from ... import *"\nbinds all names defined in the imported module, except those beginning\nwith an underscore. This form may only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name). It\nis illegal to unbind a name that is referenced by an enclosing scope;\nthe compiler will report a "SyntaxError".\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the global statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "__builtin__". The global namespace is searched first.\nIf the name is not found there, the builtins namespace is searched.\nThe global statement must precede all uses of the name.\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used). By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "__builtin__" (note: no\n\'s\'); when in any other module, "__builtins__" is an alias for the\ndictionary of the "__builtin__" module itself. "__builtins__" can be\nset to a user-created dictionary to create a weak form of restricted\nexecution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail. Users\nwanting to override values in the builtins namespace should "import"\nthe "__builtin__" (no\'s\') module and modify its attributes\nappropriately.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n"__main__".\n\nThe "global" statement has the same scope as a name binding operation\nin the same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nA class definition is an executable statement that may use and define\nnames. These references follow the normal rules for name resolution.\nThe namespace of the class definition becomes the attribute dictionary\nof the class. Names defined at the class scope are not visible in\nmethods.\n\n\nInteraction with dynamic features\n=================================\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nIf the wild card form of import --- "import *" --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a "SyntaxError".\n\nIf "exec" is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n"SyntaxError" unless the exec explicitly specifies the local namespace\nfor the "exec". (In other words, "exec obj" would be illegal, but\n"exec obj in ns" would be legal.)\n\nThe "eval()", "execfile()", and "input()" functions and the "exec"\nstatement do not have access to the full environment for resolving\nnames. Names may be resolved in the local and global namespaces of\nthe caller. Free variables are not resolved in the nearest enclosing\nnamespace, but in the global namespace. [1] The "exec" statement and\nthe "eval()" and "execfile()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n',
51'numbers': u'\nNumeric literals\n****************\n\nThere are four types of numeric literals: plain integers, long\nintegers, floating point numbers, and imaginary numbers. There are no\ncomplex literals (complex numbers can be formed by adding a real\nnumber and an imaginary number).\n\nNote that numeric literals do not include a sign; a phrase like "-1"\nis actually an expression composed of the unary operator\'"-"\'and the\nliteral "1".\n',
52'numeric-types': u'\nEmulating numeric types\n***********************\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\nThese methods are called to implement the binary arithmetic\noperations ("+", "-", "*", "//", "%", "divmod()", "pow()", "**",\n"<<", ">>", "&", "^", "|"). For instance, to evaluate the\nexpression "x + y", where *x* is an instance of a class that has an\n"__add__()" method, "x.__add__(y)" is called. The "__divmod__()"\nmethod should be the equivalent to using "__floordiv__()" and\n"__mod__()"; it should not be related to "__truediv__()" (described\nbelow). Note that "__pow__()" should be defined to accept an\noptional third argument if the ternary version of the built-in\n"pow()" function is to be supported.\n\nIf one of those methods does not support the operation with the\nsupplied arguments, it should return "NotImplemented".\n\nobject.__div__(self, other)\nobject.__truediv__(self, other)\n\nThe division operator ("/") is implemented by these methods. The\n"__truediv__()" method is used when "__future__.division" is in\neffect, otherwise "__div__()" is used. If only one of these two\nmethods is defined, the object will not support division in the\nalternate context; "TypeError" will be raised instead.\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rdiv__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\nThese methods are called to implement the binary arithmetic\noperations ("+", "-", "*", "/", "%", "divmod()", "pow()", "**",\n"<<", ">>", "&", "^", "|") with reflected (swapped) operands.\nThese functions are only called if the left operand does not\nsupport the corresponding operation and the operands are of\ndifferent types. [2] For instance, to evaluate the expression "x -\ny", where *y* is an instance of a class that has an "__rsub__()"\nmethod, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n*NotImplemented*.\n\nNote that ternary "pow()" will not try calling "__rpow__()" (the\ncoercion rules would become too complicated).\n\nNote: If the right operand\'s type is a subclass of the left\noperand\'s type and that subclass provides the reflected method\nfor the operation, this method will be called before the left\noperand\'s non-reflected method. This behavior allows subclasses\nto override their ancestors\'operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__idiv__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\nThese methods are called to implement the augmented arithmetic\nassignments ("+=", "-=", "*=", "/=", "//=", "%=", "**=", "<<=",\n">>=", "&=", "^=", "|="). These methods should attempt to do the\noperation in-place (modifying *self*) and return the result (which\ncould be, but does not have to be, *self*). If a specific method\nis not defined, the augmented assignment falls back to the normal\nmethods. For instance, to execute the statement "x += y", where\n*x* is an instance of a class that has an "__iadd__()" method,\n"x.__iadd__(y)" is called. If *x* is an instance of a class that\ndoes not define a "__iadd__()" method, "x.__add__(y)" and\n"y.__radd__(x)" are considered, as with the evaluation of "x + y".\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\nCalled to implement the unary arithmetic operations ("-", "+",\n"abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__long__(self)\nobject.__float__(self)\n\nCalled to implement the built-in functions "complex()", "int()",\n"long()", and "float()". Should return a value of the appropriate\ntype.\n\nobject.__oct__(self)\nobject.__hex__(self)\n\nCalled to implement the built-in functions "oct()" and "hex()".\nShould return a string value.\n\nobject.__index__(self)\n\nCalled to implement "operator.index()". Also called whenever\nPython needs an integer object (such as in slicing). Must return\nan integer (int or long).\n\nNew in version 2.5.\n\nobject.__coerce__(self, other)\n\nCalled to implement "mixed-mode" numeric arithmetic. Should either\nreturn a 2-tuple containing *self* and *other* converted to a\ncommon numeric type, or "None" if conversion is impossible. When\nthe common type would be the type of "other", it is sufficient to\nreturn "None", since the interpreter will also ask the other object\nto attempt a coercion (but sometimes, if the implementation of the\nother type cannot be changed, it is useful to do the conversion to\nthe other type here). A return value of "NotImplemented" is\nequivalent to returning "None".\n',
53'objects': u'\nObjects, values and types\n*************************\n\n*Objects* are Python\'s abstraction for data. All data in a Python\nprogram is represented by objects or by relations between objects. (In\na sense, and in conformance to Von Neumann\'s model of a "stored\nprogram computer," code is also represented by objects.)\n\nEvery object has an identity, a type and a value. An object\'s\n*identity* never changes once it has been created; you may think of it\nas the object\'s address in memory. The\'"is"\'operator compares the\nidentity of two objects; the "id()" function returns an integer\nrepresenting its identity (currently implemented as its address). An\nobject\'s *type* is also unchangeable. [1] An object\'s type determines\nthe operations that the object supports (e.g., "does it have a\nlength?") and also defines the possible values for objects of that\ntype. The "type()" function returns an object\'s type (which is an\nobject itself). The *value* of some objects can change. Objects\nwhose value can change are said to be *mutable*; objects whose value\nis unchangeable once they are created are called *immutable*. (The\nvalue of an immutable container object that contains a reference to a\nmutable object can change when the latter\'s value is changed; however\nthe container is still considered immutable, because the collection of\nobjects it contains cannot be changed. So, immutability is not\nstrictly the same as having an unchangeable value, it is more subtle.)\nAn object\'s mutability is determined by its type; for instance,\nnumbers, strings and tuples are immutable, while dictionaries and\nlists are mutable.\n\nObjects are never explicitly destroyed; however, when they become\nunreachable they may be garbage-collected. An implementation is\nallowed to postpone garbage collection or omit it altogether --- it is\na matter of implementation quality how garbage collection is\nimplemented, as long as no objects are collected that are still\nreachable.\n\n**CPython implementation detail:** CPython currently uses a reference-\ncounting scheme with (optional) delayed detection of cyclically linked\ngarbage, which collects most objects as soon as they become\nunreachable, but is not guaranteed to collect garbage containing\ncircular references. See the documentation of the "gc" module for\ninformation on controlling the collection of cyclic garbage. Other\nimplementations act differently and CPython may change. Do not depend\non immediate finalization of objects when they become unreachable (ex:\nalways close files).\n\nNote that the use of the implementation\'s tracing or debugging\nfacilities may keep objects alive that would normally be collectable.\nAlso note that catching an exception with a\'"try"..."except"\'\nstatement may keep objects alive.\n\nSome objects contain references to "external" resources such as open\nfiles or windows. It is understood that these resources are freed\nwhen the object is garbage-collected, but since garbage collection is\nnot guaranteed to happen, such objects also provide an explicit way to\nrelease the external resource, usually a "close()" method. Programs\nare strongly recommended to explicitly close such objects. The\n\'"try"..."finally"\'statement provides a convenient way to do this.\n\nSome objects contain references to other objects; these are called\n*containers*. Examples of containers are tuples, lists and\ndictionaries. The references are part of a container\'s value. In\nmost cases, when we talk about the value of a container, we imply the\nvalues, not the identities of the contained objects; however, when we\ntalk about the mutability of a container, only the identities of the\nimmediately contained objects are implied. So, if an immutable\ncontainer (like a tuple) contains a reference to a mutable object, its\nvalue changes if that mutable object is changed.\n\nTypes affect almost all aspects of object behavior. Even the\nimportance of object identity is affected in some sense: for immutable\ntypes, operations that compute new values may actually return a\nreference to any existing object with the same type and value, while\nfor mutable objects this is not allowed. E.g., after "a = 1; b = 1",\n"a" and "b" may or may not refer to the same object with the value\none, depending on the implementation, but after "c = []; d = []", "c"\nand "d" are guaranteed to refer to two different, unique, newly\ncreated empty lists. (Note that "c = d = []" assigns the same object\nto both "c" and "d".)\n',
54'operator-summary': u'\nOperator precedence\n*******************\n\nThe following table summarizes the operator precedences in Python,\nfrom lowest precedence (least binding) to highest precedence (most\nbinding). Operators in the same box have the same precedence. Unless\nthe syntax is explicitly given, operators are binary. Operators in\nthe same box group left to right (except for comparisons, including\ntests, which all have the same precedence and chain from left to right\n--- see section Comparisons --- and exponentiation, which groups from\nright to left).\n\n+-------------------------------------------------+---------------------------------------+\n| Operator | Description |\n+=================================================+=======================================+\n| "lambda" | Lambda expression |\n+-------------------------------------------------+---------------------------------------+\n| "if" -- "else" | Conditional expression |\n+-------------------------------------------------+---------------------------------------+\n| "or" | Boolean OR |\n+-------------------------------------------------+---------------------------------------+\n| "and" | Boolean AND |\n+-------------------------------------------------+---------------------------------------+\n| "not" "x" | Boolean NOT |\n+-------------------------------------------------+---------------------------------------+\n| "in", "not in", "is", "is not", "<", "<=", ">", | Comparisons, including membership |\n| ">=", "<>", "!=", "==" | tests and identity tests |\n+-------------------------------------------------+---------------------------------------+\n| "|" | Bitwise OR |\n+-------------------------------------------------+---------------------------------------+\n| "^" | Bitwise XOR |\n+-------------------------------------------------+---------------------------------------+\n| "&" | Bitwise AND |\n+-------------------------------------------------+---------------------------------------+\n| "<<", ">>" | Shifts |\n+-------------------------------------------------+---------------------------------------+\n| "+", "-" | Addition and subtraction |\n+-------------------------------------------------+---------------------------------------+\n| "*", "/", "//", "%" | Multiplication, division, remainder |\n| | [8] |\n+-------------------------------------------------+---------------------------------------+\n| "+x", "-x", "~x" | Positive, negative, bitwise NOT |\n+-------------------------------------------------+---------------------------------------+\n| "**" | Exponentiation [9] |\n+-------------------------------------------------+---------------------------------------+\n| "x[index]", "x[index:index]", | Subscription, slicing, call, |\n| "x(arguments...)", "x.attribute" | attribute reference |\n+-------------------------------------------------+---------------------------------------+\n| "(expressions...)", "[expressions...]", "{key: | Binding or tuple display, list |\n| value...}", "`expressions...`" | display, dictionary display, string |\n| | conversion |\n+-------------------------------------------------+---------------------------------------+\n\n-[ Footnotes ]-\n\n[1] In Python 2.3 and later releases, a list comprehension "leaks"\nthe control variables of each "for" it contains into the\ncontaining scope. However, this behavior is deprecated, and\nrelying on it will not work in Python 3.\n\n[2] While "abs(x%y) < abs(y)" is true mathematically, for floats\nit may not be true numerically due to roundoff. For example, and\nassuming a platform on which a Python float is an IEEE 754 double-\nprecision number, in order that "-1e-100 % 1e100" have the same\nsign as "1e100", the computed result is "-1e-100 + 1e100", which\nis numerically exactly equal to "1e100". The function\n"math.fmod()" returns a result whose sign matches the sign of the\nfirst argument instead, and so returns "-1e-100" in this case.\nWhich approach is more appropriate depends on the application.\n\n[3] If x is very close to an exact integer multiple of y, it\'s\npossible for "floor(x/y)" to be one larger than "(x-x%y)/y" due to\nrounding. In such cases, Python returns the latter result, in\norder to preserve that "divmod(x,y)[0] * y + x % y" be very close\nto "x".\n\n[4] While comparisons between unicode strings make sense at the\nbyte level, they may be counter-intuitive to users. For example,\nthe strings "u"\\u00C7"" and "u"\\u0043\\u0327"" compare differently,\neven though they both represent the same unicode character (LATIN\nCAPITAL LETTER C WITH CEDILLA). To compare strings in a human\nrecognizable way, compare using "unicodedata.normalize()".\n\n[5] The implementation computes this efficiently, without\nconstructing lists or sorting.\n\n[6] Earlier versions of Python used lexicographic comparison of\nthe sorted (key, value) lists, but this was very expensive for the\ncommon case of comparing for equality. An even earlier version of\nPython compared dictionaries by identity only, but this caused\nsurprises because people expected to be able to test a dictionary\nfor emptiness by comparing it to "{}".\n\n[7] Due to automatic garbage-collection, free lists, and the\ndynamic nature of descriptors, you may notice seemingly unusual\nbehaviour in certain uses of the "is" operator, like those\ninvolving comparisons between instance methods, or constants.\nCheck their documentation for more info.\n\n[8] The "%" operator is also used for string formatting; the same\nprecedence applies.\n\n[9] The power operator "**" binds less tightly than an arithmetic\nor bitwise unary operator on its right, that is, "2**-1" is "0.5".\n',
55'pass': u'\nThe "pass" statement\n********************\n\npass_stmt ::= "pass"\n\n"pass" is a null operation --- when it is executed, nothing happens.\nIt is useful as a placeholder when a statement is required\nsyntactically, but no code needs to be executed, for example:\n\ndef f(arg): pass # a function that does nothing (yet)\n\nclass C: pass # a class with no methods (yet)\n',
56'power': u'\nThe power operator\n******************\n\nThe power operator binds more tightly than unary operators on its\nleft; it binds less tightly than unary operators on its right. The\nsyntax is:\n\npower ::= primary ["**" u_expr]\n\nThus, in an unparenthesized sequence of power and unary operators, the\noperators are evaluated from right to left (this does not constrain\nthe evaluation order for the operands): "-1**2" results in "-1".\n\nThe power operator has the same semantics as the built-in "pow()"\nfunction, when called with two arguments: it yields its left argument\nraised to the power of its right argument. The numeric arguments are\nfirst converted to a common type. The result type is that of the\narguments after coercion.\n\nWith mixed operand types, the coercion rules for binary arithmetic\noperators apply. For int and long int operands, the result has the\nsame type as the operands (after coercion) unless the second argument\nis negative; in that case, all arguments are converted to float and a\nfloat result is delivered. For example, "10**2" returns "100", but\n"10**-2" returns "0.01". (This last feature was added in Python 2.2.\nIn Python 2.1 and before, if both arguments were of integer types and\nthe second argument was negative, an exception was raised).\n\nRaising "0.0" to a negative power results in a "ZeroDivisionError".\nRaising a negative number to a fractional power results in a\n"ValueError".\n',
57'print': u'\nThe "print" statement\n*********************\n\nprint_stmt ::= "print" ([expression ("," expression)* [","]]\n| ">>" expression [("," expression)+ [","]])\n\n"print" evaluates each expression in turn and writes the resulting\nobject to standard output (see below). If an object is not a string,\nit is first converted to a string using the rules for string\nconversions. The (resulting or original) string is then written. A\nspace is written before each object is (converted and) written, unless\nthe output system believes it is positioned at the beginning of a\nline. This is the case (1) when no characters have yet been written\nto standard output, (2) when the last character written to standard\noutput is a whitespace character except "\' \'", or (3) when the last\nwrite operation on standard output was not a "print" statement. (In\nsome cases it may be functional to write an empty string to standard\noutput for this reason.)\n\nNote: Objects which act like file objects but which are not the\nbuilt-in file objects often do not properly emulate this aspect of\nthe file object\'s behavior, so it is best not to rely on this.\n\nA "\'\\n\'" character is written at the end, unless the "print" statement\nends with a comma. This is the only action if the statement contains\njust the keyword "print".\n\nStandard output is defined as the file object named "stdout" in the\nbuilt-in module "sys". If no such object exists, or if it does not\nhave a "write()" method, a "RuntimeError" exception is raised.\n\n"print" also has an extended form, defined by the second portion of\nthe syntax described above. This form is sometimes referred to as\n""print" chevron." In this form, the first expression after the ">>"\nmust evaluate to a "file-like" object, specifically an object that has\na "write()" method as described above. With this extended form, the\nsubsequent expressions are printed to this file object. If the first\nexpression evaluates to "None", then "sys.stdout" is used as the file\nfor output.\n',
58'raise': u'\nThe "raise" statement\n*********************\n\nraise_stmt ::= "raise" [expression ["," expression ["," expression]]]\n\nIf no expressions are present, "raise" re-raises the last exception\nthat was active in the current scope. If no exception is active in\nthe current scope, a "TypeError" exception is raised indicating that\nthis is an error (if running under IDLE, a "Queue.Empty" exception is\nraised instead).\n\nOtherwise, "raise" evaluates the expressions to get three objects,\nusing "None" as the value of omitted expressions. The first two\nobjects are used to determine the *type* and *value* of the exception.\n\nIf the first object is an instance, the type of the exception is the\nclass of the instance, the instance itself is the value, and the\nsecond object must be "None".\n\nIf the first object is a class, it becomes the type of the exception.\nThe second object is used to determine the exception value: If it is\nan instance of the class, the instance becomes the exception value. If\nthe second object is a tuple, it is used as the argument list for the\nclass constructor; if it is "None", an empty argument list is used,\nand any other object is treated as a single argument to the\nconstructor. The instance so created by calling the constructor is\nused as the exception value.\n\nIf a third object is present and not "None", it must be a traceback\nobject (see section The standard type hierarchy), and it is\nsubstituted instead of the current location as the place where the\nexception occurred. If the third object is present and not a\ntraceback object or "None", a "TypeError" exception is raised. The\nthree-expression form of "raise" is useful to re-raise an exception\ntransparently in an except clause, but "raise" with no expressions\nshould be preferred if the exception to be re-raised was the most\nrecently active exception in the current scope.\n\nAdditional information on exceptions can be found in section\nExceptions, and information about handling exceptions is in section\nThe try statement.\n',
59'return': u'\nThe "return" statement\n**********************\n\nreturn_stmt ::= "return" [expression_list]\n\n"return" may only occur syntactically nested in a function definition,\nnot within a nested class definition.\n\nIf an expression list is present, it is evaluated, else "None" is\nsubstituted.\n\n"return" leaves the current function call with the expression list (or\n"None") as return value.\n\nWhen "return" passes control out of a "try" statement with a "finally"\nclause, that "finally" clause is executed before really leaving the\nfunction.\n\nIn a generator function, the "return" statement is not allowed to\ninclude an "expression_list". In that context, a bare "return"\nindicates that the generator is done and will cause "StopIteration" to\nbe raised.\n',
60'sequence-types': u'\nEmulating container types\n*************************\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. (For backwards compatibility, the method\n"__getslice__()" (see below) can also be defined to handle simple, but\nnot extended slices.) It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "has_key()", "get()",\n"clear()", "setdefault()", "iterkeys()", "itervalues()",\n"iteritems()", "pop()", "popitem()", "copy()", and "update()" behaving\nsimilar to those for Python\'s standard dictionary objects. The\n"UserDict" module provides a "DictMixin" class to help create those\nmethods from a base set of "__getitem__()", "__setitem__()",\n"__delitem__()", and "keys()". Mutable sequences should provide\nmethods "append()", "count()", "index()", "extend()", "insert()",\n"pop()", "remove()", "reverse()" and "sort()", like Python standard\nlist objects. Finally, sequence types should implement addition\n(meaning concatenation) and multiplication (meaning repetition) by\ndefining the methods "__add__()", "__radd__()", "__iadd__()",\n"__mul__()", "__rmul__()" and "__imul__()" described below; they\nshould not define "__coerce__()" or other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should be equivalent of "has_key()"; for sequences,\nit should search through the values. It is further recommended that\nboth mappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "iterkeys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\nCalled to implement the built-in function "len()". Should return\nthe length of the object, an integer ">=" 0. Also, an object that\ndoesn\'t define a "__nonzero__()" method and whose "__len__()"\nmethod returns zero is considered to be false in a Boolean context.\n\nobject.__getitem__(self, key)\n\nCalled to implement evaluation of "self[key]". For sequence types,\nthe accepted keys should be integers and slice objects. Note that\nthe special interpretation of negative indexes (if the class wishes\nto emulate a sequence type) is up to the "__getitem__()" method. If\n*key* is of an inappropriate type, "TypeError" may be raised; if of\na value outside the set of indexes for the sequence (after any\nspecial interpretation of negative values), "IndexError" should be\nraised. For mapping types, if *key* is missing (not in the\ncontainer), "KeyError" should be raised.\n\nNote: "for" loops expect that an "IndexError" will be raised for\nillegal indexes to allow proper detection of the end of the\nsequence.\n\nobject.__missing__(self, key)\n\nCalled by "dict"."__getitem__()" to implement "self[key]" for dict\nsubclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\nCalled to implement assignment to "self[key]". Same note as for\n"__getitem__()". This should only be implemented for mappings if\nthe objects support changes to the values for keys, or if new keys\ncan be added, or for sequences if elements can be replaced. The\nsame exceptions should be raised for improper *key* values as for\nthe "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\nCalled to implement deletion of "self[key]". Same note as for\n"__getitem__()". This should only be implemented for mappings if\nthe objects support removal of keys, or for sequences if elements\ncan be removed from the sequence. The same exceptions should be\nraised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\nThis method is called when an iterator is required for a container.\nThis method should return a new iterator object that can iterate\nover all the objects in the container. For mappings, it should\niterate over the keys of the container, and should also be made\navailable as the method "iterkeys()".\n\nIterator objects also need to implement this method; they are\nrequired to return themselves. For more information on iterator\nobjects, see Iterator Types.\n\nobject.__reversed__(self)\n\nCalled (if present) by the "reversed()" built-in to implement\nreverse iteration. It should return a new iterator object that\niterates over all the objects in the container in reverse order.\n\nIf the "__reversed__()" method is not provided, the "reversed()"\nbuilt-in will fall back to using the sequence protocol ("__len__()"\nand "__getitem__()"). Objects that support the sequence protocol\nshould only provide "__reversed__()" if they can provide an\nimplementation that is more efficient than the one provided by\n"reversed()".\n\nNew in version 2.6.\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\nCalled to implement membership test operators. Should return true\nif *item* is in *self*, false otherwise. For mapping objects, this\nshould consider the keys of the mapping rather than the values or\nthe key-item pairs.\n\nFor objects that don\'t define "__contains__()", the membership test\nfirst tries iteration via "__iter__()", then the old sequence\niteration protocol via "__getitem__()", see this section in the\nlanguage reference.\n',
61'shifting': u'\nShifting operations\n*******************\n\nThe shifting operations have lower priority than the arithmetic\noperations:\n\nshift_expr ::= a_expr | shift_expr ( "<<" | ">>" ) a_expr\n\nThese operators accept plain or long integers as arguments. The\narguments are converted to a common type. They shift the first\nargument to the left or right by the number of bits given by the\nsecond argument.\n\nA right shift by *n* bits is defined as division by "pow(2, n)". A\nleft shift by *n* bits is defined as multiplication with "pow(2, n)".\nNegative shift counts raise a "ValueError" exception.\n\nNote: In the current implementation, the right-hand operand is\nrequired to be at most "sys.maxsize". If the right-hand operand is\nlarger than "sys.maxsize" an "OverflowError" exception is raised.\n',
62'slicings': u'\nSlicings\n********\n\nA slicing selects a range of items in a sequence object (e.g., a\nstring, tuple or list). Slicings may be used as expressions or as\ntargets in assignment or "del" statements. The syntax for a slicing:\n\nslicing ::= simple_slicing | extended_slicing\nsimple_slicing ::= primary "[" short_slice "]"\nextended_slicing ::= primary "[" slice_list "]"\nslice_list ::= slice_item ("," slice_item)* [","]\nslice_item ::= expression | proper_slice | ellipsis\nproper_slice ::= short_slice | long_slice\nshort_slice ::= [lower_bound] ":" [upper_bound]\nlong_slice ::= short_slice ":" [stride]\nlower_bound ::= expression\nupper_bound ::= expression\nstride ::= expression\nellipsis ::= "..."\n\nThere is ambiguity in the formal syntax here: anything that looks like\nan expression list also looks like a slice list, so any subscription\ncan be interpreted as a slicing. Rather than further complicating the\nsyntax, this is disambiguated by defining that in this case the\ninterpretation as a subscription takes priority over the\ninterpretation as a slicing (this is the case if the slice list\ncontains no proper slice nor ellipses). Similarly, when the slice\nlist has exactly one short slice and no trailing comma, the\ninterpretation as a simple slicing takes priority over that as an\nextended slicing.\n\nThe semantics for a simple slicing are as follows. The primary must\nevaluate to a sequence object. The lower and upper bound expressions,\nif present, must evaluate to plain integers; defaults are zero and the\n"sys.maxint", respectively. If either bound is negative, the\nsequence\'s length is added to it. The slicing now selects all items\nwith index *k* such that "i <= k < j" where *i* and *j* are the\nspecified lower and upper bounds. This may be an empty sequence. It\nis not an error if *i* or *j* lie outside the range of valid indexes\n(such items don\'t exist so they aren\'t selected).\n\nThe semantics for an extended slicing are as follows. The primary\nmust evaluate to a mapping object, and it is indexed with a key that\nis constructed from the slice list, as follows. If the slice list\ncontains at least one comma, the key is a tuple containing the\nconversion of the slice items; otherwise, the conversion of the lone\nslice item is the key. The conversion of a slice item that is an\nexpression is that expression. The conversion of an ellipsis slice\nitem is the built-in "Ellipsis" object. The conversion of a proper\nslice is a slice object (see section The standard type hierarchy)\nwhose "start", "stop" and "step" attributes are the values of the\nexpressions given as lower bound, upper bound and stride,\nrespectively, substituting "None" for missing expressions.\n',
63'specialattrs': u'\nSpecial Attributes\n******************\n\nThe implementation adds a few special read-only attributes to several\nobject types, where they are relevant. Some of these are not reported\nby the "dir()" built-in function.\n\nobject.__dict__\n\nA dictionary or other mapping object used to store an object\'s\n(writable) attributes.\n\nobject.__methods__\n\nDeprecated since version 2.2: Use the built-in function "dir()" to\nget a list of an object\'s attributes. This attribute is no longer\navailable.\n\nobject.__members__\n\nDeprecated since version 2.2: Use the built-in function "dir()" to\nget a list of an object\'s attributes. This attribute is no longer\navailable.\n\ninstance.__class__\n\nThe class to which a class instance belongs.\n\nclass.__bases__\n\nThe tuple of base classes of a class object.\n\nclass.__name__\n\nThe name of the class or type.\n\nThe following attributes are only supported by *new-style class*es.\n\nclass.__mro__\n\nThis attribute is a tuple of classes that are considered when\nlooking for base classes during method resolution.\n\nclass.mro()\n\nThis method can be overridden by a metaclass to customize the\nmethod resolution order for its instances. It is called at class\ninstantiation, and its result is stored in "__mro__".\n\nclass.__subclasses__()\n\nEach new-style class keeps a list of weak references to its\nimmediate subclasses. This method returns a list of all those\nreferences still alive. Example:\n\n>>> int.__subclasses__()\n[<type\'bool\'>]\n\n-[ Footnotes ]-\n\n[1] Additional information on these special methods may be found\nin the Python Reference Manual (Basic customization).\n\n[2] As a consequence, the list "[1, 2]" is considered equal to\n"[1.0, 2.0]", and similarly for tuples.\n\n[3] They must have since the parser can\'t tell the type of the\noperands.\n\n[4] Cased characters are those with general category property\nbeing one of "Lu" (Letter, uppercase), "Ll" (Letter, lowercase),\nor "Lt" (Letter, titlecase).\n\n[5] To format only a tuple you should therefore provide a\nsingleton tuple whose only element is the tuple to be formatted.\n\n[6] The advantage of leaving the newline on is that returning an\nempty string is then an unambiguous EOF indication. It is also\npossible (in cases where it might matter, for example, if you want\nto make an exact copy of a file while scanning its lines) to tell\nwhether the last line of a file ended in a newline or not (yes\nthis happens!).\n',
64'specialnames': u'\nSpecial method names\n********************\n\nA class can implement certain operations that are invoked by special\nsyntax (such as arithmetic operations or subscripting and slicing) by\ndefining methods with special names. This is Python\'s approach to\n*operator overloading*, allowing classes to define their own behavior\nwith respect to language operators. For instance, if a class defines\na method named "__getitem__()", and "x" is an instance of this class,\nthen "x[i]" is roughly equivalent to "x.__getitem__(i)" for old-style\nclasses and "type(x).__getitem__(x, i)" for new-style classes. Except\nwhere mentioned, attempts to execute an operation raise an exception\nwhen no appropriate method is defined (typically "AttributeError" or\n"TypeError").\n\nWhen implementing a class that emulates any built-in type, it is\nimportant that the emulation only be implemented to the degree that it\nmakes sense for the object being modelled. For example, some\nsequences may work well with retrieval of individual elements, but\nextracting a slice may not make sense. (One example of this is the\n"NodeList" interface in the W3C\'s Document Object Model.)\n\n\nBasic customization\n===================\n\nobject.__new__(cls[, ...])\n\nCalled to create a new instance of class *cls*. "__new__()" is a\nstatic method (special-cased so you need not declare it as such)\nthat takes the class of which an instance was requested as its\nfirst argument. The remaining arguments are those passed to the\nobject constructor expression (the call to the class). The return\nvalue of "__new__()" should be the new object instance (usually an\ninstance of *cls*).\n\nTypical implementations create a new instance of the class by\ninvoking the superclass\'s "__new__()" method using\n"super(currentclass, cls).__new__(cls[, ...])" with appropriate\narguments and then modifying the newly-created instance as\nnecessary before returning it.\n\nIf "__new__()" returns an instance of *cls*, then the new\ninstance\'s "__init__()" method will be invoked like\n"__init__(self[, ...])", where *self* is the new instance and the\nremaining arguments are the same as were passed to "__new__()".\n\nIf "__new__()" does not return an instance of *cls*, then the new\ninstance\'s "__init__()" method will not be invoked.\n\n"__new__()" is intended mainly to allow subclasses of immutable\ntypes (like int, str, or tuple) to customize instance creation. It\nis also commonly overridden in custom metaclasses in order to\ncustomize class creation.\n\nobject.__init__(self[, ...])\n\nCalled after the instance has been created (by "__new__()"), but\nbefore it is returned to the caller. The arguments are those\npassed to the class constructor expression. If a base class has an\n"__init__()" method, the derived class\'s "__init__()" method, if\nany, must explicitly call it to ensure proper initialization of the\nbase class part of the instance; for example:\n"BaseClass.__init__(self, [args...])".\n\nBecause "__new__()" and "__init__()" work together in constructing\nobjects ("__new__()" to create it, and "__init__()" to customise\nit), no non-"None" value may be returned by "__init__()"; doing so\nwill cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\nCalled when the instance is about to be destroyed. This is also\ncalled a destructor. If a base class has a "__del__()" method, the\nderived class\'s "__del__()" method, if any, must explicitly call it\nto ensure proper deletion of the base class part of the instance.\nNote that it is possible (though not recommended!) for the\n"__del__()" method to postpone destruction of the instance by\ncreating a new reference to it. It may then be called at a later\ntime when this new reference is deleted. It is not guaranteed that\n"__del__()" methods are called for objects that still exist when\nthe interpreter exits.\n\nNote: "del x" doesn\'t directly call "x.__del__()" --- the former\ndecrements the reference count for "x" by one, and the latter is\nonly called when "x"\'s reference count reaches zero. Some common\nsituations that may prevent the reference count of an object from\ngoing to zero include: circular references between objects (e.g.,\na doubly-linked list or a tree data structure with parent and\nchild pointers); a reference to the object on the stack frame of\na function that caught an exception (the traceback stored in\n"sys.exc_traceback" keeps the stack frame alive); or a reference\nto the object on the stack frame that raised an unhandled\nexception in interactive mode (the traceback stored in\n"sys.last_traceback" keeps the stack frame alive). The first\nsituation can only be remedied by explicitly breaking the cycles;\nthe latter two situations can be resolved by storing "None" in\n"sys.exc_traceback" or "sys.last_traceback". Circular references\nwhich are garbage are detected when the option cycle detector is\nenabled (it\'s on by default), but can only be cleaned up if there\nare no Python-level "__del__()" methods involved. Refer to the\ndocumentation for the "gc" module for more information about how\n"__del__()" methods are handled by the cycle detector,\nparticularly the description of the "garbage" value.\n\nWarning: Due to the precarious circumstances under which\n"__del__()" methods are invoked, exceptions that occur during\ntheir execution are ignored, and a warning is printed to\n"sys.stderr" instead. Also, when "__del__()" is invoked in\nresponse to a module being deleted (e.g., when execution of the\nprogram is done), other globals referenced by the "__del__()"\nmethod may already have been deleted or in the process of being\ntorn down (e.g. the import machinery shutting down). For this\nreason, "__del__()" methods should do the absolute minimum needed\nto maintain external invariants. Starting with version 1.5,\nPython guarantees that globals whose name begins with a single\nunderscore are deleted from their module before other globals are\ndeleted; if no other references to such globals exist, this may\nhelp in assuring that imported modules are still available at the\ntime when the "__del__()" method is called.\n\nSee also the "-R" command-line option.\n\nobject.__repr__(self)\n\nCalled by the "repr()" built-in function and by string conversions\n(reverse quotes) to compute the "official" string representation of\nan object. If at all possible, this should look like a valid\nPython expression that could be used to recreate an object with the\nsame value (given an appropriate environment). If this is not\npossible, a string of the form "<...some useful description...>"\nshould be returned. The return value must be a string object. If a\nclass defines "__repr__()" but not "__str__()", then "__repr__()"\nis also used when an "informal" string representation of instances\nof that class is required.\n\nThis is typically used for debugging, so it is important that the\nrepresentation is information-rich and unambiguous.\n\nobject.__str__(self)\n\nCalled by the "str()" built-in function and by the "print"\nstatement to compute the "informal" string representation of an\nobject. This differs from "__repr__()" in that it does not have to\nbe a valid Python expression: a more convenient or concise\nrepresentation may be used instead. The return value must be a\nstring object.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\nNew in version 2.1.\n\nThese are the so-called "rich comparison" methods, and are called\nfor comparison operators in preference to "__cmp__()" below. The\ncorrespondence between operator symbols and method names is as\nfollows: "x<y" calls "x.__lt__(y)", "x<=y" calls "x.__le__(y)",\n"x==y" calls "x.__eq__(y)", "x!=y" and "x<>y" call "x.__ne__(y)",\n"x>y" calls "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\nA rich comparison method may return the singleton "NotImplemented"\nif it does not implement the operation for a given pair of\narguments. By convention, "False" and "True" are returned for a\nsuccessful comparison. However, these methods can return any value,\nso if the comparison operator is used in a Boolean context (e.g.,\nin the condition of an "if" statement), Python will call "bool()"\non the value to determine if the result is true or false.\n\nThere are no implied relationships among the comparison operators.\nThe truth of "x==y" does not imply that "x!=y" is false.\nAccordingly, when defining "__eq__()", one should also define\n"__ne__()" so that the operators will behave as expected. See the\nparagraph on "__hash__()" for some important notes on creating\n*hashable* objects which support custom comparison operations and\nare usable as dictionary keys.\n\nThere are no swapped-argument versions of these methods (to be used\nwhen the left argument does not support the operation but the right\nargument does); rather, "__lt__()" and "__gt__()" are each other\'s\nreflection, "__le__()" and "__ge__()" are each other\'s reflection,\nand "__eq__()" and "__ne__()" are their own reflection.\n\nArguments to rich comparison methods are never coerced.\n\nTo automatically generate ordering operations from a single root\noperation, see "functools.total_ordering()".\n\nobject.__cmp__(self, other)\n\nCalled by comparison operations if rich comparison (see above) is\nnot defined. Should return a negative integer if "self < other",\nzero if "self == other", a positive integer if "self > other". If\nno "__cmp__()", "__eq__()" or "__ne__()" operation is defined,\nclass instances are compared by object identity ("address"). See\nalso the description of "__hash__()" for some important notes on\ncreating *hashable* objects which support custom comparison\noperations and are usable as dictionary keys. (Note: the\nrestriction that exceptions are not propagated by "__cmp__()" has\nbeen removed since Python 1.5.)\n\nobject.__rcmp__(self, other)\n\nChanged in version 2.1: No longer supported.\n\nobject.__hash__(self)\n\nCalled by built-in function "hash()" and for operations on members\nof hashed collections including "set", "frozenset", and "dict".\n"__hash__()" should return an integer. The only required property\nis that objects which compare equal have the same hash value; it is\nadvised to somehow mix together (e.g. using exclusive or) the hash\nvalues for the components of the object that also play a part in\ncomparison of objects.\n\nIf a class does not define a "__cmp__()" or "__eq__()" method it\nshould not define a "__hash__()" operation either; if it defines\n"__cmp__()" or "__eq__()" but not "__hash__()", its instances will\nnot be usable in hashed collections. If a class defines mutable\nobjects and implements a "__cmp__()" or "__eq__()" method, it\nshould not implement "__hash__()", since hashable collection\nimplementations require that a object\'s hash value is immutable (if\nthe object\'s hash value changes, it will be in the wrong hash\nbucket).\n\nUser-defined classes have "__cmp__()" and "__hash__()" methods by\ndefault; with them, all objects compare unequal (except with\nthemselves) and "x.__hash__()" returns a result derived from\n"id(x)".\n\nClasses which inherit a "__hash__()" method from a parent class but\nchange the meaning of "__cmp__()" or "__eq__()" such that the hash\nvalue returned is no longer appropriate (e.g. by switching to a\nvalue-based concept of equality instead of the default identity\nbased equality) can explicitly flag themselves as being unhashable\nby setting "__hash__ = None" in the class definition. Doing so\nmeans that not only will instances of the class raise an\nappropriate "TypeError" when a program attempts to retrieve their\nhash value, but they will also be correctly identified as\nunhashable when checking "isinstance(obj, collections.Hashable)"\n(unlike classes which define their own "__hash__()" to explicitly\nraise "TypeError").\n\nChanged in version 2.5: "__hash__()" may now also return a long\ninteger object; the 32-bit integer is then derived from the hash of\nthat object.\n\nChanged in version 2.6: "__hash__" may now be set to "None" to\nexplicitly flag instances of a class as unhashable.\n\nobject.__nonzero__(self)\n\nCalled to implement truth value testing and the built-in operation\n"bool()"; should return "False" or "True", or their integer\nequivalents "0" or "1". When this method is not defined,\n"__len__()" is called, if it is defined, and the object is\nconsidered true if its result is nonzero. If a class defines\nneither "__len__()" nor "__nonzero__()", all its instances are\nconsidered true.\n\nobject.__unicode__(self)\n\nCalled to implement "unicode()" built-in; should return a Unicode\nobject. When this method is not defined, string conversion is\nattempted, and the result of string conversion is converted to\nUnicode using the system default encoding.\n\n\nCustomizing attribute access\n============================\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\nCalled when an attribute lookup has not found the attribute in the\nusual places (i.e. it is not an instance attribute nor is it found\nin the class tree for "self"). "name" is the attribute name. This\nmethod should return the (computed) attribute value or raise an\n"AttributeError" exception.\n\nNote that if the attribute is found through the normal mechanism,\n"__getattr__()" is not called. (This is an intentional asymmetry\nbetween "__getattr__()" and "__setattr__()".) This is done both for\nefficiency reasons and because otherwise "__getattr__()" would have\nno way to access other attributes of the instance. Note that at\nleast for instance variables, you can fake total control by not\ninserting any values in the instance attribute dictionary (but\ninstead inserting them in another object). See the\n"__getattribute__()" method below for a way to actually get total\ncontrol in new-style classes.\n\nobject.__setattr__(self, name, value)\n\nCalled when an attribute assignment is attempted. This is called\ninstead of the normal mechanism (i.e. store the value in the\ninstance dictionary). *name* is the attribute name, *value* is the\nvalue to be assigned to it.\n\nIf "__setattr__()" wants to assign to an instance attribute, it\nshould not simply execute "self.name = value" --- this would cause\na recursive call to itself. Instead, it should insert the value in\nthe dictionary of instance attributes, e.g., "self.__dict__[name] =\nvalue". For new-style classes, rather than accessing the instance\ndictionary, it should call the base class method with the same\nname, for example, "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\nLike "__setattr__()" but for attribute deletion instead of\nassignment. This should only be implemented if "del obj.name" is\nmeaningful for the object.\n\n\nMore attribute access for new-style classes\n-------------------------------------------\n\nThe following methods only apply to new-style classes.\n\nobject.__getattribute__(self, name)\n\nCalled unconditionally to implement attribute accesses for\ninstances of the class. If the class also defines "__getattr__()",\nthe latter will not be called unless "__getattribute__()" either\ncalls it explicitly or raises an "AttributeError". This method\nshould return the (computed) attribute value or raise an\n"AttributeError" exception. In order to avoid infinite recursion in\nthis method, its implementation should always call the base class\nmethod with the same name to access any attributes it needs, for\nexample, "object.__getattribute__(self, name)".\n\nNote: This method may still be bypassed when looking up special\nmethods as the result of implicit invocation via language syntax\nor built-in functions. See Special method lookup for new-style\nclasses.\n\n\nImplementing Descriptors\n------------------------\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\'"__dict__".\n\nobject.__get__(self, instance, owner)\n\nCalled to get the attribute of the owner class (class attribute\naccess) or of an instance of that class (instance attribute\naccess). *owner* is always the owner class, while *instance* is the\ninstance that the attribute was accessed through, or "None" when\nthe attribute is accessed through the *owner*. This method should\nreturn the (computed) attribute value or raise an "AttributeError"\nexception.\n\nobject.__set__(self, instance, value)\n\nCalled to set the attribute on an instance *instance* of the owner\nclass to a new value, *value*.\n\nobject.__delete__(self, instance)\n\nCalled to delete the attribute on an instance *instance* of the\nowner class.\n\n\nInvoking Descriptors\n--------------------\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called. Note that descriptors are only invoked for new\nstyle objects or classes (ones that subclass "object()" or "type()").\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\nThe simplest and least common call is when user code directly\ninvokes a descriptor method: "x.__get__(a)".\n\nInstance Binding\nIf binding to a new-style object instance, "a.x" is transformed\ninto the call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\nIf binding to a new-style class, "A.x" is transformed into the\ncall: "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\nIf "a" is an instance of "super", then the binding "super(B,\nobj).m()" searches "obj.__class__.__mro__" for the base class "A"\nimmediately preceding "B" and then invokes the descriptor with the\ncall: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()". If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary. If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor. Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method. Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n---------\n\nBy default, instances of both old and new-style classes have a\ndictionary for attribute storage. This wastes space for objects\nhaving very few instance variables. The space consumption can become\nacute when creating large numbers of instances.\n\nThe default can be overridden by defining *__slots__* in a new-style\nclass definition. The *__slots__* declaration takes a sequence of\ninstance variables and reserves just enough space in each instance to\nhold a value for each variable. Space is saved because *__dict__* is\nnot created for each instance.\n\n__slots__\n\nThis class variable can be assigned a string, iterable, or sequence\nof strings with variable names used by instances. If defined in a\nnew-style class, *__slots__* reserves space for the declared\nvariables and prevents the automatic creation of *__dict__* and\n*__weakref__* for each instance.\n\nNew in version 2.2.\n\nNotes on using *__slots__*\n\n* When inheriting from a class without *__slots__*, the *__dict__*\nattribute of that class will always be accessible, so a *__slots__*\ndefinition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\nvariables not listed in the *__slots__* definition. Attempts to\nassign to an unlisted variable name raises "AttributeError". If\ndynamic assignment of new variables is desired, then add\n"\'__dict__\'" to the sequence of strings in the *__slots__*\ndeclaration.\n\nChanged in version 2.3: Previously, adding "\'__dict__\'" to the\n*__slots__* declaration would not enable the assignment of new\nattributes not specifically listed in the sequence of instance\nvariable names.\n\n* Without a *__weakref__* variable for each instance, classes\ndefining *__slots__* do not support weak references to its\ninstances. If weak reference support is needed, then add\n"\'__weakref__\'" to the sequence of strings in the *__slots__*\ndeclaration.\n\nChanged in version 2.3: Previously, adding "\'__weakref__\'" to the\n*__slots__* declaration would not enable support for weak\nreferences.\n\n* *__slots__* are implemented at the class level by creating\ndescriptors (Implementing Descriptors) for each variable name. As a\nresult, class attributes cannot be used to set default values for\ninstance variables defined by *__slots__*; otherwise, the class\nattribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\nwhere it is defined. As a result, subclasses will have a *__dict__*\nunless they also define *__slots__* (which must only contain names\nof any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\ninstance variable defined by the base class slot is inaccessible\n(except by retrieving its descriptor directly from the base class).\nThis renders the meaning of the program undefined. In the future, a\ncheck may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n"variable-length" built-in types such as "long", "str" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\nmay also be used; however, in the future, special meaning may be\nassigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n*__slots__*.\n\nChanged in version 2.6: Previously, *__class__* assignment raised an\nerror if either new or old class had *__slots__*.\n\n\nCustomizing class creation\n==========================\n\nBy default, new-style classes are constructed using "type()". A class\ndefinition is read into a separate namespace and the value of class\nname is bound to the result of "type(name, bases, dict)".\n\nWhen the class definition is read, if *__metaclass__* is defined then\nthe callable assigned to it will be called instead of "type()". This\nallows classes or functions to be written which monitor or alter the\nclass creation process:\n\n* Modifying the class dictionary prior to the class being created.\n\n* Returning an instance of another class -- essentially performing\nthe role of a factory function.\n\nThese steps will have to be performed in the metaclass\'s "__new__()"\nmethod -- "type.__new__()" can then be called from this method to\ncreate a class with different properties. This example adds a new\nelement to the class dictionary before creating the class:\n\nclass metacls(type):\ndef __new__(mcs, name, bases, dict):\ndict[\'foo\'] =\'metacls was here\'\nreturn type.__new__(mcs, name, bases, dict)\n\nYou can of course also override other class methods (or add new\nmethods); for example defining a custom "__call__()" method in the\nmetaclass allows custom behavior when the class is called, e.g. not\nalways creating a new instance.\n\n__metaclass__\n\nThis variable can be any callable accepting arguments for "name",\n"bases", and "dict". Upon class creation, the callable is used\ninstead of the built-in "type()".\n\nNew in version 2.2.\n\nThe appropriate metaclass is determined by the following precedence\nrules:\n\n* If "dict[\'__metaclass__\']" exists, it is used.\n\n* Otherwise, if there is at least one base class, its metaclass is\nused (this looks for a *__class__* attribute first and if not found,\nuses its type).\n\n* Otherwise, if a global variable named __metaclass__ exists, it is\nused.\n\n* Otherwise, the old-style, classic metaclass (types.ClassType) is\nused.\n\nThe potential uses for metaclasses are boundless. Some ideas that have\nbeen explored including logging, interface checking, automatic\ndelegation, automatic property creation, proxies, frameworks, and\nautomatic resource locking/synchronization.\n\n\nCustomizing instance and subclass checks\n========================================\n\nNew in version 2.6.\n\nThe following methods are used to override the default behavior of the\n"isinstance()" and "issubclass()" built-in functions.\n\nIn particular, the metaclass "abc.ABCMeta" implements these methods in\norder to allow the addition of Abstract Base Classes (ABCs) as\n"virtual base classes" to any class or type (including built-in\ntypes), including other ABCs.\n\nclass.__instancecheck__(self, instance)\n\nReturn true if *instance* should be considered a (direct or\nindirect) instance of *class*. If defined, called to implement\n"isinstance(instance, class)".\n\nclass.__subclasscheck__(self, subclass)\n\nReturn true if *subclass* should be considered a (direct or\nindirect) subclass of *class*. If defined, called to implement\n"issubclass(subclass, class)".\n\nNote that these methods are looked up on the type (metaclass) of a\nclass. They cannot be defined as class methods in the actual class.\nThis is consistent with the lookup of special methods that are called\non instances, only in this case the instance is itself a class.\n\nSee also: **PEP 3119** - Introducing Abstract Base Classes\n\nIncludes the specification for customizing "isinstance()" and\n"issubclass()" behavior through "__instancecheck__()" and\n"__subclasscheck__()", with motivation for this functionality in\nthe context of adding Abstract Base Classes (see the "abc"\nmodule) to the language.\n\n\nEmulating callable objects\n==========================\n\nobject.__call__(self[, args...])\n\nCalled when the instance is "called" as a function; if this method\nis defined, "x(arg1, arg2, ...)" is a shorthand for\n"x.__call__(arg1, arg2, ...)".\n\n\nEmulating container types\n=========================\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. (For backwards compatibility, the method\n"__getslice__()" (see below) can also be defined to handle simple, but\nnot extended slices.) It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "has_key()", "get()",\n"clear()", "setdefault()", "iterkeys()", "itervalues()",\n"iteritems()", "pop()", "popitem()", "copy()", and "update()" behaving\nsimilar to those for Python\'s standard dictionary objects. The\n"UserDict" module provides a "DictMixin" class to help create those\nmethods from a base set of "__getitem__()", "__setitem__()",\n"__delitem__()", and "keys()". Mutable sequences should provide\nmethods "append()", "count()", "index()", "extend()", "insert()",\n"pop()", "remove()", "reverse()" and "sort()", like Python standard\nlist objects. Finally, sequence types should implement addition\n(meaning concatenation) and multiplication (meaning repetition) by\ndefining the methods "__add__()", "__radd__()", "__iadd__()",\n"__mul__()", "__rmul__()" and "__imul__()" described below; they\nshould not define "__coerce__()" or other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should be equivalent of "has_key()"; for sequences,\nit should search through the values. It is further recommended that\nboth mappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "iterkeys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\nCalled to implement the built-in function "len()". Should return\nthe length of the object, an integer ">=" 0. Also, an object that\ndoesn\'t define a "__nonzero__()" method and whose "__len__()"\nmethod returns zero is considered to be false in a Boolean context.\n\nobject.__getitem__(self, key)\n\nCalled to implement evaluation of "self[key]". For sequence types,\nthe accepted keys should be integers and slice objects. Note that\nthe special interpretation of negative indexes (if the class wishes\nto emulate a sequence type) is up to the "__getitem__()" method. If\n*key* is of an inappropriate type, "TypeError" may be raised; if of\na value outside the set of indexes for the sequence (after any\nspecial interpretation of negative values), "IndexError" should be\nraised. For mapping types, if *key* is missing (not in the\ncontainer), "KeyError" should be raised.\n\nNote: "for" loops expect that an "IndexError" will be raised for\nillegal indexes to allow proper detection of the end of the\nsequence.\n\nobject.__missing__(self, key)\n\nCalled by "dict"."__getitem__()" to implement "self[key]" for dict\nsubclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\nCalled to implement assignment to "self[key]". Same note as for\n"__getitem__()". This should only be implemented for mappings if\nthe objects support changes to the values for keys, or if new keys\ncan be added, or for sequences if elements can be replaced. The\nsame exceptions should be raised for improper *key* values as for\nthe "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\nCalled to implement deletion of "self[key]". Same note as for\n"__getitem__()". This should only be implemented for mappings if\nthe objects support removal of keys, or for sequences if elements\ncan be removed from the sequence. The same exceptions should be\nraised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\nThis method is called when an iterator is required for a container.\nThis method should return a new iterator object that can iterate\nover all the objects in the container. For mappings, it should\niterate over the keys of the container, and should also be made\navailable as the method "iterkeys()".\n\nIterator objects also need to implement this method; they are\nrequired to return themselves. For more information on iterator\nobjects, see Iterator Types.\n\nobject.__reversed__(self)\n\nCalled (if present) by the "reversed()" built-in to implement\nreverse iteration. It should return a new iterator object that\niterates over all the objects in the container in reverse order.\n\nIf the "__reversed__()" method is not provided, the "reversed()"\nbuilt-in will fall back to using the sequence protocol ("__len__()"\nand "__getitem__()"). Objects that support the sequence protocol\nshould only provide "__reversed__()" if they can provide an\nimplementation that is more efficient than the one provided by\n"reversed()".\n\nNew in version 2.6.\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\nCalled to implement membership test operators. Should return true\nif *item* is in *self*, false otherwise. For mapping objects, this\nshould consider the keys of the mapping rather than the values or\nthe key-item pairs.\n\nFor objects that don\'t define "__contains__()", the membership test\nfirst tries iteration via "__iter__()", then the old sequence\niteration protocol via "__getitem__()", see this section in the\nlanguage reference.\n\n\nAdditional methods for emulation of sequence types\n==================================================\n\nThe following optional methods can be defined to further emulate\nsequence objects. Immutable sequences methods should at most only\ndefine "__getslice__()"; mutable sequences might define all three\nmethods.\n\nobject.__getslice__(self, i, j)\n\nDeprecated since version 2.0: Support slice objects as parameters\nto the "__getitem__()" method. (However, built-in types in CPython\ncurrently still implement "__getslice__()". Therefore, you have to\noverride it in derived classes when implementing slicing.)\n\nCalled to implement evaluation of "self[i:j]". The returned object\nshould be of the same type as *self*. Note that missing *i* or *j*\nin the slice expression are replaced by zero or "sys.maxsize",\nrespectively. If negative indexes are used in the slice, the\nlength of the sequence is added to that index. If the instance does\nnot implement the "__len__()" method, an "AttributeError" is\nraised. No guarantee is made that indexes adjusted this way are not\nstill negative. Indexes which are greater than the length of the\nsequence are not modified. If no "__getslice__()" is found, a slice\nobject is created instead, and passed to "__getitem__()" instead.\n\nobject.__setslice__(self, i, j, sequence)\n\nCalled to implement assignment to "self[i:j]". Same notes for *i*\nand *j* as for "__getslice__()".\n\nThis method is deprecated. If no "__setslice__()" is found, or for\nextended slicing of the form "self[i:j:k]", a slice object is\ncreated, and passed to "__setitem__()", instead of "__setslice__()"\nbeing called.\n\nobject.__delslice__(self, i, j)\n\nCalled to implement deletion of "self[i:j]". Same notes for *i* and\n*j* as for "__getslice__()". This method is deprecated. If no\n"__delslice__()" is found, or for extended slicing of the form\n"self[i:j:k]", a slice object is created, and passed to\n"__delitem__()", instead of "__delslice__()" being called.\n\nNotice that these methods are only invoked when a single slice with a\nsingle colon is used, and the slice method is available. For slice\noperations involving extended slice notation, or in absence of the\nslice methods, "__getitem__()", "__setitem__()" or "__delitem__()" is\ncalled with a slice object as argument.\n\nThe following example demonstrate how to make your program or module\ncompatible with earlier versions of Python (assuming that methods\n"__getitem__()", "__setitem__()" and "__delitem__()" support slice\nobjects as arguments):\n\nclass MyClass:\n...\ndef __getitem__(self, index):\n...\ndef __setitem__(self, index, value):\n...\ndef __delitem__(self, index):\n...\n\nif sys.version_info < (2, 0):\n# They won\'t be defined if version is at least 2.0 final\n\ndef __getslice__(self, i, j):\nreturn self[max(0, i):max(0, j):]\ndef __setslice__(self, i, j, seq):\nself[max(0, i):max(0, j):] = seq\ndef __delslice__(self, i, j):\ndel self[max(0, i):max(0, j):]\n...\n\nNote the calls to "max()"; these are necessary because of the handling\nof negative indices before the "__*slice__()" methods are called.\nWhen negative indexes are used, the "__*item__()" methods receive them\nas provided, but the "__*slice__()" methods get a "cooked" form of the\nindex values. For each negative index value, the length of the\nsequence is added to the index before calling the method (which may\nstill result in a negative index); this is the customary handling of\nnegative indexes by the built-in sequence types, and the "__*item__()"\nmethods are expected to do this as well. However, since they should\nalready be doing that, negative indexes cannot be passed in; they must\nbe constrained to the bounds of the sequence before being passed to\nthe "__*item__()" methods. Calling "max(0, i)" conveniently returns\nthe proper value.\n\n\nEmulating numeric types\n=======================\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\nThese methods are called to implement the binary arithmetic\noperations ("+", "-", "*", "//", "%", "divmod()", "pow()", "**",\n"<<", ">>", "&", "^", "|"). For instance, to evaluate the\nexpression "x + y", where *x* is an instance of a class that has an\n"__add__()" method, "x.__add__(y)" is called. The "__divmod__()"\nmethod should be the equivalent to using "__floordiv__()" and\n"__mod__()"; it should not be related to "__truediv__()" (described\nbelow). Note that "__pow__()" should be defined to accept an\noptional third argument if the ternary version of the built-in\n"pow()" function is to be supported.\n\nIf one of those methods does not support the operation with the\nsupplied arguments, it should return "NotImplemented".\n\nobject.__div__(self, other)\nobject.__truediv__(self, other)\n\nThe division operator ("/") is implemented by these methods. The\n"__truediv__()" method is used when "__future__.division" is in\neffect, otherwise "__div__()" is used. If only one of these two\nmethods is defined, the object will not support division in the\nalternate context; "TypeError" will be raised instead.\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rdiv__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\nThese methods are called to implement the binary arithmetic\noperations ("+", "-", "*", "/", "%", "divmod()", "pow()", "**",\n"<<", ">>", "&", "^", "|") with reflected (swapped) operands.\nThese functions are only called if the left operand does not\nsupport the corresponding operation and the operands are of\ndifferent types. [2] For instance, to evaluate the expression "x -\ny", where *y* is an instance of a class that has an "__rsub__()"\nmethod, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n*NotImplemented*.\n\nNote that ternary "pow()" will not try calling "__rpow__()" (the\ncoercion rules would become too complicated).\n\nNote: If the right operand\'s type is a subclass of the left\noperand\'s type and that subclass provides the reflected method\nfor the operation, this method will be called before the left\noperand\'s non-reflected method. This behavior allows subclasses\nto override their ancestors\'operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__idiv__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\nThese methods are called to implement the augmented arithmetic\nassignments ("+=", "-=", "*=", "/=", "//=", "%=", "**=", "<<=",\n">>=", "&=", "^=", "|="). These methods should attempt to do the\noperation in-place (modifying *self*) and return the result (which\ncould be, but does not have to be, *self*). If a specific method\nis not defined, the augmented assignment falls back to the normal\nmethods. For instance, to execute the statement "x += y", where\n*x* is an instance of a class that has an "__iadd__()" method,\n"x.__iadd__(y)" is called. If *x* is an instance of a class that\ndoes not define a "__iadd__()" method, "x.__add__(y)" and\n"y.__radd__(x)" are considered, as with the evaluation of "x + y".\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\nCalled to implement the unary arithmetic operations ("-", "+",\n"abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__long__(self)\nobject.__float__(self)\n\nCalled to implement the built-in functions "complex()", "int()",\n"long()", and "float()". Should return a value of the appropriate\ntype.\n\nobject.__oct__(self)\nobject.__hex__(self)\n\nCalled to implement the built-in functions "oct()" and "hex()".\nShould return a string value.\n\nobject.__index__(self)\n\nCalled to implement "operator.index()". Also called whenever\nPython needs an integer object (such as in slicing). Must return\nan integer (int or long).\n\nNew in version 2.5.\n\nobject.__coerce__(self, other)\n\nCalled to implement "mixed-mode" numeric arithmetic. Should either\nreturn a 2-tuple containing *self* and *other* converted to a\ncommon numeric type, or "None" if conversion is impossible. When\nthe common type would be the type of "other", it is sufficient to\nreturn "None", since the interpreter will also ask the other object\nto attempt a coercion (but sometimes, if the implementation of the\nother type cannot be changed, it is useful to do the conversion to\nthe other type here). A return value of "NotImplemented" is\nequivalent to returning "None".\n\n\nCoercion rules\n==============\n\nThis section used to document the rules for coercion. As the language\nhas evolved, the coercion rules have become hard to document\nprecisely; documenting what one version of one particular\nimplementation does is undesirable. Instead, here are some informal\nguidelines regarding coercion. In Python 3, coercion will not be\nsupported.\n\n* If the left operand of a % operator is a string or Unicode object,\nno coercion takes place and the string formatting operation is\ninvoked instead.\n\n* It is no longer recommended to define a coercion operation. Mixed-\nmode operations on types that don\'t define coercion pass the\noriginal arguments to the operation.\n\n* New-style classes (those derived from "object") never invoke the\n"__coerce__()" method in response to a binary operator; the only\ntime "__coerce__()" is invoked is when the built-in function\n"coerce()" is called.\n\n* For most intents and purposes, an operator that returns\n"NotImplemented" is treated the same as one that is not implemented\nat all.\n\n* Below, "__op__()" and "__rop__()" are used to signify the generic\nmethod names corresponding to an operator; "__iop__()" is used for\nthe corresponding in-place operator. For example, for the operator\n \'"+"\', "__add__()" and "__radd__()" are used for the left and right\nvariant of the binary operator, and "__iadd__()" for the in-place\nvariant.\n\n* For objects *x* and *y*, first "x.__op__(y)" is tried. If this is\nnot implemented or returns "NotImplemented", "y.__rop__(x)" is\ntried. If this is also not implemented or returns "NotImplemented",\na "TypeError" exception is raised. But see the following exception:\n\n* Exception to the previous item: if the left operand is an instance\nof a built-in type or a new-style class, and the right operand is an\ninstance of a proper subclass of that type or class and overrides\nthe base\'s "__rop__()" method, the right operand\'s "__rop__()"\nmethod is tried *before* the left operand\'s "__op__()" method.\n\nThis is done so that a subclass can completely override binary\noperators. Otherwise, the left operand\'s "__op__()" method would\nalways accept the right operand: when an instance of a given class\nis expected, an instance of a subclass of that class is always\nacceptable.\n\n* When either operand type defines a coercion, this coercion is\ncalled before that type\'s "__op__()" or "__rop__()" method is\ncalled, but no sooner. If the coercion returns an object of a\ndifferent type for the operand whose coercion is invoked, part of\nthe process is redone using the new object.\n\n* When an in-place operator (like\'"+="\') is used, if the left\noperand implements "__iop__()", it is invoked without any coercion.\nWhen the operation falls back to "__op__()" and/or "__rop__()", the\nnormal coercion rules apply.\n\n* In "x + y", if *x* is a sequence that implements sequence\nconcatenation, sequence concatenation is invoked.\n\n* In "x * y", if one operand is a sequence that implements sequence\nrepetition, and the other is an integer ("int" or "long"), sequence\nrepetition is invoked.\n\n* Rich comparisons (implemented by methods "__eq__()" and so on)\nnever use coercion. Three-way comparison (implemented by\n"__cmp__()") does use coercion under the same conditions as other\nbinary operations use it.\n\n* In the current implementation, the built-in numeric types "int",\n"long", "float", and "complex" do not use coercion. All these types\nimplement a "__coerce__()" method, for use by the built-in\n"coerce()" function.\n\nChanged in version 2.7: The complex type no longer makes implicit\ncalls to the "__coerce__()" method for mixed-type binary arithmetic\noperations.\n\n\nWith Statement Context Managers\n===============================\n\nNew in version 2.5.\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section The with\nstatement), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see Context Manager Types.\n\nobject.__enter__(self)\n\nEnter the runtime context related to this object. The "with"\nstatement will bind this method\'s return value to the target(s)\nspecified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\nExit the runtime context related to this object. The parameters\ndescribe the exception that caused the context to be exited. If the\ncontext was exited without an exception, all three arguments will\nbe "None".\n\nIf an exception is supplied, and the method wishes to suppress the\nexception (i.e., prevent it from being propagated), it should\nreturn a true value. Otherwise, the exception will be processed\nnormally upon exit from this method.\n\nNote that "__exit__()" methods should not reraise the passed-in\nexception; this is the caller\'s responsibility.\n\nSee also: **PEP 0343** - The "with" statement\n\nThe specification, background, and examples for the Python "with"\nstatement.\n\n\nSpecial method lookup for old-style classes\n===========================================\n\nFor old-style classes, special methods are always looked up in exactly\nthe same way as any other method or attribute. This is the case\nregardless of whether the method is being looked up explicitly as in\n"x.__getitem__(i)" or implicitly as in "x[i]".\n\nThis behaviour means that special methods may exhibit different\nbehaviour for different instances of a single old-style class if the\nappropriate special attributes are set differently:\n\n>>> class C:\n... pass\n...\n>>> c1 = C()\n>>> c2 = C()\n>>> c1.__len__ = lambda: 5\n>>> c2.__len__ = lambda: 9\n>>> len(c1)\n5\n>>> len(c2)\n9\n\n\nSpecial method lookup for new-style classes\n===========================================\n\nFor new-style classes, implicit invocations of special methods are\nonly guaranteed to work correctly if defined on an object\'s type, not\nin the object\'s instance dictionary. That behaviour is the reason why\nthe following code raises an exception (unlike the equivalent example\nwith old-style classes):\n\n>>> class C(object):\n... pass\n...\n>>> c = C()\n>>> c.__len__ = lambda: 5\n>>> len(c)\nTraceback (most recent call last):\nFile "<stdin>", line 1, in <module>\nTypeError: object of type\'C\'has no len()\n\nThe rationale behind this behaviour lies with a number of special\nmethods such as "__hash__()" and "__repr__()" that are implemented by\nall objects, including type objects. If the implicit lookup of these\nmethods used the conventional lookup process, they would fail when\ninvoked on the type object itself:\n\n>>> 1 .__hash__() == hash(1)\nTrue\n>>> int.__hash__() == hash(int)\nTraceback (most recent call last):\nFile "<stdin>", line 1, in <module>\nTypeError: descriptor\'__hash__\'of\'int\'object needs an argument\n\nIncorrectly attempting to invoke an unbound method of a class in this\nway is sometimes referred to as\'metaclass confusion\', and is avoided\nby bypassing the instance when looking up special methods:\n\n>>> type(1).__hash__(1) == hash(1)\nTrue\n>>> type(int).__hash__(int) == hash(int)\nTrue\n\nIn addition to bypassing any instance attributes in the interest of\ncorrectness, implicit special method lookup generally also bypasses\nthe "__getattribute__()" method even of the object\'s metaclass:\n\n>>> class Meta(type):\n... def __getattribute__(*args):\n... print "Metaclass getattribute invoked"\n... return type.__getattribute__(*args)\n...\n>>> class C(object):\n... __metaclass__ = Meta\n... def __len__(self):\n... return 10\n... def __getattribute__(*args):\n... print "Class getattribute invoked"\n... return object.__getattribute__(*args)\n...\n>>> c = C()\n>>> c.__len__() # Explicit lookup via instance\nClass getattribute invoked\n10\n>>> type(c).__len__(c) # Explicit lookup via type\nMetaclass getattribute invoked\n10\n>>> len(c) # Implicit lookup\n10\n\nBypassing the "__getattribute__()" machinery in this fashion provides\nsignificant scope for speed optimisations within the interpreter, at\nthe cost of some flexibility in the handling of special methods (the\nspecial method *must* be set on the class object itself in order to be\nconsistently invoked by the interpreter).\n\n-[ Footnotes ]-\n\n[1] It *is* possible in some cases to change an object\'s type,\nunder certain controlled conditions. It generally isn\'t a good\nidea though, since it can lead to some very strange behaviour if\nit is handled incorrectly.\n\n[2] For operands of the same type, it is assumed that if the non-\nreflected method (such as "__add__()") fails the operation is not\nsupported, which is why the reflected method is not called.\n',
65'string-methods': u'\nString Methods\n**************\n\nBelow are listed the string methods which both 8-bit strings and\nUnicode objects support. Some of them are also available on\n"bytearray" objects.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the Sequence Types --- str, unicode, list, tuple,\nbytearray, buffer, xrange section. To output formatted strings use\ntemplate strings or the "%" operator described in the String\nFormatting Operations section. Also, see the "re" module for string\nfunctions based on regular expressions.\n\nstr.capitalize()\n\nReturn a copy of the string with its first character capitalized\nand the rest lowercased.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.center(width[, fillchar])\n\nReturn centered in a string of length *width*. Padding is done\nusing the specified *fillchar* (default is a space).\n\nChanged in version 2.4: Support for the *fillchar* argument.\n\nstr.count(sub[, start[, end]])\n\nReturn the number of non-overlapping occurrences of substring *sub*\nin the range [*start*, *end*]. Optional arguments *start* and\n*end* are interpreted as in slice notation.\n\nstr.decode([encoding[, errors]])\n\nDecodes the string using the codec registered for *encoding*.\n*encoding* defaults to the default string encoding. *errors* may\nbe given to set a different error handling scheme. The default is\n"\'strict\'", meaning that encoding errors raise "UnicodeError".\nOther possible values are "\'ignore\'", "\'replace\'" and any other\nname registered via "codecs.register_error()", see section Codec\nBase Classes.\n\nNew in version 2.2.\n\nChanged in version 2.3: Support for other error handling schemes\nadded.\n\nChanged in version 2.7: Support for keyword arguments added.\n\nstr.encode([encoding[, errors]])\n\nReturn an encoded version of the string. Default encoding is the\ncurrent default string encoding. *errors* may be given to set a\ndifferent error handling scheme. The default for *errors* is\n"\'strict\'", meaning that encoding errors raise a "UnicodeError".\nOther possible values are "\'ignore\'", "\'replace\'",\n"\'xmlcharrefreplace\'", "\'backslashreplace\'" and any other name\nregistered via "codecs.register_error()", see section Codec Base\nClasses. For a list of possible encodings, see section Standard\nEncodings.\n\nNew in version 2.0.\n\nChanged in version 2.3: Support for "\'xmlcharrefreplace\'" and\n"\'backslashreplace\'" and other error handling schemes added.\n\nChanged in version 2.7: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\nReturn "True" if the string ends with the specified *suffix*,\notherwise return "False". *suffix* can also be a tuple of suffixes\nto look for. With optional *start*, test beginning at that\nposition. With optional *end*, stop comparing at that position.\n\nChanged in version 2.5: Accept tuples as *suffix*.\n\nstr.expandtabs([tabsize])\n\nReturn a copy of the string where all tab characters are replaced\nby one or more spaces, depending on the current column and the\ngiven tab size. Tab positions occur every *tabsize* characters\n(default is 8, giving tab positions at columns 0, 8, 16 and so on).\nTo expand the string, the current column is set to zero and the\nstring is examined character by character. If the character is a\ntab ("\\t"), one or more space characters are inserted in the result\nuntil the current column is equal to the next tab position. (The\ntab character itself is not copied.) If the character is a newline\n("\\n") or return ("\\r"), it is copied and the current column is\nreset to zero. Any other character is copied unchanged and the\ncurrent column is incremented by one regardless of how the\ncharacter is represented when printed.\n\n>>>\'01\\t012\\t0123\\t01234\'.expandtabs()\n \'01 012 0123 01234\'\n>>>\'01\\t012\\t0123\\t01234\'.expandtabs(4)\n \'01 012 0123 01234\'\n\nstr.find(sub[, start[, end]])\n\nReturn the lowest index in the string where substring *sub* is\nfound, such that *sub* is contained in the slice "s[start:end]".\nOptional arguments *start* and *end* are interpreted as in slice\nnotation. Return "-1" if *sub* is not found.\n\nNote: The "find()" method should be used only if you need to know\nthe position of *sub*. To check if *sub* is a substring or not,\nuse the "in" operator:\n\n>>>\'Py\'in\'Python\'\nTrue\n\nstr.format(*args, **kwargs)\n\nPerform a string formatting operation. The string on which this\nmethod is called can contain literal text or replacement fields\ndelimited by braces "{}". Each replacement field contains either\nthe numeric index of a positional argument, or the name of a\nkeyword argument. Returns a copy of the string where each\nreplacement field is replaced with the string value of the\ncorresponding argument.\n\n>>> "The sum of 1 + 2 is{0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\nSee Format String Syntax for a description of the various\nformatting options that can be specified in format strings.\n\nThis method of string formatting is the new standard in Python 3,\nand should be preferred to the "%" formatting described in String\nFormatting Operations in new code.\n\nNew in version 2.6.\n\nstr.index(sub[, start[, end]])\n\nLike "find()", but raise "ValueError" when the substring is not\nfound.\n\nstr.isalnum()\n\nReturn true if all characters in the string are alphanumeric and\nthere is at least one character, false otherwise.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.isalpha()\n\nReturn true if all characters in the string are alphabetic and\nthere is at least one character, false otherwise.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.isdigit()\n\nReturn true if all characters in the string are digits and there is\nat least one character, false otherwise.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.islower()\n\nReturn true if all cased characters [4] in the string are lowercase\nand there is at least one cased character, false otherwise.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.isspace()\n\nReturn true if there are only whitespace characters in the string\nand there is at least one character, false otherwise.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.istitle()\n\nReturn true if the string is a titlecased string and there is at\nleast one character, for example uppercase characters may only\nfollow uncased characters and lowercase characters only cased ones.\nReturn false otherwise.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.isupper()\n\nReturn true if all cased characters [4] in the string are uppercase\nand there is at least one cased character, false otherwise.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.join(iterable)\n\nReturn a string which is the concatenation of the strings in the\n*iterable* *iterable*. The separator between elements is the\nstring providing this method.\n\nstr.ljust(width[, fillchar])\n\nReturn the string left justified in a string of length *width*.\nPadding is done using the specified *fillchar* (default is a\nspace). The original string is returned if *width* is less than or\nequal to "len(s)".\n\nChanged in version 2.4: Support for the *fillchar* argument.\n\nstr.lower()\n\nReturn a copy of the string with all the cased characters [4]\nconverted to lowercase.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.lstrip([chars])\n\nReturn a copy of the string with leading characters removed. The\n*chars* argument is a string specifying the set of characters to be\nremoved. If omitted or "None", the *chars* argument defaults to\nremoving whitespace. The *chars* argument is not a prefix; rather,\nall combinations of its values are stripped:\n\n>>>\'spacious\'.lstrip()\n \'spacious\'\n>>>\'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\nChanged in version 2.2.2: Support for the *chars* argument.\n\nstr.partition(sep)\n\nSplit the string at the first occurrence of *sep*, and return a\n3-tuple containing the part before the separator, the separator\nitself, and the part after the separator. If the separator is not\nfound, return a 3-tuple containing the string itself, followed by\ntwo empty strings.\n\nNew in version 2.5.\n\nstr.replace(old, new[, count])\n\nReturn a copy of the string with all occurrences of substring *old*\nreplaced by *new*. If the optional argument *count* is given, only\nthe first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\nReturn the highest index in the string where substring *sub* is\nfound, such that *sub* is contained within "s[start:end]".\nOptional arguments *start* and *end* are interpreted as in slice\nnotation. Return "-1" on failure.\n\nstr.rindex(sub[, start[, end]])\n\nLike "rfind()" but raises "ValueError" when the substring *sub* is\nnot found.\n\nstr.rjust(width[, fillchar])\n\nReturn the string right justified in a string of length *width*.\nPadding is done using the specified *fillchar* (default is a\nspace). The original string is returned if *width* is less than or\nequal to "len(s)".\n\nChanged in version 2.4: Support for the *fillchar* argument.\n\nstr.rpartition(sep)\n\nSplit the string at the last occurrence of *sep*, and return a\n3-tuple containing the part before the separator, the separator\nitself, and the part after the separator. If the separator is not\nfound, return a 3-tuple containing two empty strings, followed by\nthe string itself.\n\nNew in version 2.5.\n\nstr.rsplit([sep[, maxsplit]])\n\nReturn a list of the words in the string, using *sep* as the\ndelimiter string. If *maxsplit* is given, at most *maxsplit* splits\nare done, the *rightmost* ones. If *sep* is not specified or\n"None", any whitespace string is a separator. Except for splitting\nfrom the right, "rsplit()" behaves like "split()" which is\ndescribed in detail below.\n\nNew in version 2.4.\n\nstr.rstrip([chars])\n\nReturn a copy of the string with trailing characters removed. The\n*chars* argument is a string specifying the set of characters to be\nremoved. If omitted or "None", the *chars* argument defaults to\nremoving whitespace. The *chars* argument is not a suffix; rather,\nall combinations of its values are stripped:\n\n>>>\'spacious\'.rstrip()\n \'spacious\'\n>>>\'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\nChanged in version 2.2.2: Support for the *chars* argument.\n\nstr.split([sep[, maxsplit]])\n\nReturn a list of the words in the string, using *sep* as the\ndelimiter string. If *maxsplit* is given, at most *maxsplit*\nsplits are done (thus, the list will have at most "maxsplit+1"\nelements). If *maxsplit* is not specified or "-1", then there is\nno limit on the number of splits (all possible splits are made).\n\nIf *sep* is given, consecutive delimiters are not grouped together\nand are deemed to delimit empty strings (for example,\n"\'1,,2\'.split(\',\')" returns "[\'1\',\'\',\'2\']"). The *sep* argument\nmay consist of multiple characters (for example,\n"\'1<>2<>3\'.split(\'<>\')" returns "[\'1\',\'2\',\'3\']"). Splitting an\nempty string with a specified separator returns "[\'\']".\n\nIf *sep* is not specified or is "None", a different splitting\nalgorithm is applied: runs of consecutive whitespace are regarded\nas a single separator, and the result will contain no empty strings\nat the start or end if the string has leading or trailing\nwhitespace. Consequently, splitting an empty string or a string\nconsisting of just whitespace with a "None" separator returns "[]".\n\nFor example, "\'1 2 3\'.split()" returns "[\'1\',\'2\',\'3\']", and\n"\'1 2 3\'.split(None, 1)" returns "[\'1\',\'2 3\']".\n\nstr.splitlines([keepends])\n\nReturn a list of the lines in the string, breaking at line\nboundaries. This method uses the *universal newlines* approach to\nsplitting lines. Line breaks are not included in the resulting list\nunless *keepends* is given and true.\n\nFor example, "\'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()" returns "[\'ab\nc\',\'\',\'de fg\',\'kl\']", while the same call with\n"splitlines(True)" returns "[\'ab c\\n\',\'\\n\',\'de fg\\r\',\'kl\\r\\n\']".\n\nUnlike "split()" when a delimiter string *sep* is given, this\nmethod returns an empty list for the empty string, and a terminal\nline break does not result in an extra line.\n\nstr.startswith(prefix[, start[, end]])\n\nReturn "True" if string starts with the *prefix*, otherwise return\n"False". *prefix* can also be a tuple of prefixes to look for.\nWith optional *start*, test string beginning at that position.\nWith optional *end*, stop comparing string at that position.\n\nChanged in version 2.5: Accept tuples as *prefix*.\n\nstr.strip([chars])\n\nReturn a copy of the string with the leading and trailing\ncharacters removed. The *chars* argument is a string specifying the\nset of characters to be removed. If omitted or "None", the *chars*\nargument defaults to removing whitespace. The *chars* argument is\nnot a prefix or suffix; rather, all combinations of its values are\nstripped:\n\n>>>\'spacious\'.strip()\n \'spacious\'\n>>>\'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\nChanged in version 2.2.2: Support for the *chars* argument.\n\nstr.swapcase()\n\nReturn a copy of the string with uppercase characters converted to\nlowercase and vice versa.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.title()\n\nReturn a titlecased version of the string where words start with an\nuppercase character and the remaining characters are lowercase.\n\nThe algorithm uses a simple language-independent definition of a\nword as groups of consecutive letters. The definition works in\nmany contexts but it means that apostrophes in contractions and\npossessives form word boundaries, which may not be the desired\nresult:\n\n>>> "they\'re bill\'s friends from the UK".title()\n"They\'Re Bill\'S Friends From The Uk"\n\nA workaround for apostrophes can be constructed using regular\nexpressions:\n\n>>> import re\n>>> def titlecase(s):\n... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n... lambda mo: mo.group(0)[0].upper() +\n... mo.group(0)[1:].lower(),\n... s)\n...\n>>> titlecase("they\'re bill\'s friends.")\n"They\'re Bill\'s Friends."\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.translate(table[, deletechars])\n\nReturn a copy of the string where all characters occurring in the\noptional argument *deletechars* are removed, and the remaining\ncharacters have been mapped through the given translation table,\nwhich must be a string of length 256.\n\nYou can use the "maketrans()" helper function in the "string"\nmodule to create a translation table. For string objects, set the\n*table* argument to "None" for translations that only delete\ncharacters:\n\n>>>\'read this short text\'.translate(None,\'aeiou\')\n \'rd ths shrt txt\'\n\nNew in version 2.6: Support for a "None" *table* argument.\n\nFor Unicode objects, the "translate()" method does not accept the\noptional *deletechars* argument. Instead, it returns a copy of the\n*s* where all characters have been mapped through the given\ntranslation table which must be a mapping of Unicode ordinals to\nUnicode ordinals, Unicode strings or "None". Unmapped characters\nare left untouched. Characters mapped to "None" are deleted. Note,\na more flexible approach is to create a custom character mapping\ncodec using the "codecs" module (see "encodings.cp1251" for an\nexample).\n\nstr.upper()\n\nReturn a copy of the string with all the cased characters [4]\nconverted to uppercase. Note that "str.upper().isupper()" might be\n"False" if "s" contains uncased characters or if the Unicode\ncategory of the resulting character(s) is not "Lu" (Letter,\nuppercase), but e.g. "Lt" (Letter, titlecase).\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.zfill(width)\n\nReturn the numeric string left filled with zeros in a string of\nlength *width*. A sign prefix is handled correctly. The original\nstring is returned if *width* is less than or equal to "len(s)".\n\nNew in version 2.2.2.\n\nThe following methods are present only on unicode objects:\n\nunicode.isnumeric()\n\nReturn "True" if there are only numeric characters in S, "False"\notherwise. Numeric characters include digit characters, and all\ncharacters that have the Unicode numeric value property, e.g.\nU+2155, VULGAR FRACTION ONE FIFTH.\n\nunicode.isdecimal()\n\nReturn "True" if there are only decimal characters in S, "False"\notherwise. Decimal characters include digit characters, and all\ncharacters that can be used to form decimal-radix numbers, e.g.\nU+0660, ARABIC-INDIC DIGIT ZERO.\n',
66'strings': u'\nString literals\n***************\n\nString literals are described by the following lexical definitions:\n\nstringliteral ::= [stringprefix](shortstring | longstring)\nstringprefix ::= "r" | "u" | "ur" | "R" | "U" | "UR" | "Ur" | "uR"\n| "b" | "B" | "br" | "Br" | "bR" | "BR"\nshortstring ::= "\'" shortstringitem* "\'" |\'"\'shortstringitem*\'"\'\nlongstring ::= "\'\'\'" longstringitem* "\'\'\'"\n|\'"""\'longstringitem*\'"""\'\nshortstringitem ::= shortstringchar | escapeseq\nlongstringitem ::= longstringchar | escapeseq\nshortstringchar ::= <any source character except "\\" or newline or the quote>\nlongstringchar ::= <any source character except "\\">\nescapeseq ::= "\\" <any ASCII character>\n\nOne syntactic restriction not indicated by these productions is that\nwhitespace is not allowed between the "stringprefix" and the rest of\nthe string literal. The source character set is defined by the\nencoding declaration; it is ASCII if no encoding declaration is given\nin the source file; see section Encoding declarations.\n\nIn plain English: String literals can be enclosed in matching single\nquotes ("\'") or double quotes ("""). They can also be enclosed in\nmatching groups of three single or double quotes (these are generally\nreferred to as *triple-quoted strings*). The backslash ("\\")\ncharacter is used to escape characters that otherwise have a special\nmeaning, such as newline, backslash itself, or the quote character.\nString literals may optionally be prefixed with a letter "\'r\'" or\n"\'R\'"; such strings are called *raw strings* and use different rules\nfor interpreting backslash escape sequences. A prefix of "\'u\'" or\n"\'U\'" makes the string a Unicode string. Unicode strings use the\nUnicode character set as defined by the Unicode Consortium and ISO\n10646. Some additional escape sequences, described below, are\navailable in Unicode strings. A prefix of "\'b\'" or "\'B\'" is ignored in\nPython 2; it indicates that the literal should become a bytes literal\nin Python 3 (e.g. when code is automatically converted with 2to3). A\n"\'u\'" or "\'b\'" prefix may be followed by an "\'r\'" prefix.\n\nIn triple-quoted strings, unescaped newlines and quotes are allowed\n(and are retained), except that three unescaped quotes in a row\nterminate the string. (A "quote" is the character used to open the\nstring, i.e. either "\'" or """.)\n\nUnless an "\'r\'" or "\'R\'" prefix is present, escape sequences in\nstrings are interpreted according to rules similar to those used by\nStandard C. The recognized escape sequences are:\n\n+-------------------+-----------------------------------+---------+\n| Escape Sequence | Meaning | Notes |\n+===================+===================================+=========+\n| "\\newline" | Ignored | |\n+-------------------+-----------------------------------+---------+\n| "\\\\" | Backslash ("\\") | |\n+-------------------+-----------------------------------+---------+\n| "\\\'" | Single quote ("\'") | |\n+-------------------+-----------------------------------+---------+\n| "\\"" | Double quote (""") | |\n+-------------------+-----------------------------------+---------+\n| "\\a" | ASCII Bell (BEL) | |\n+-------------------+-----------------------------------+---------+\n| "\\b" | ASCII Backspace (BS) | |\n+-------------------+-----------------------------------+---------+\n| "\\f" | ASCII Formfeed (FF) | |\n+-------------------+-----------------------------------+---------+\n| "\\n" | ASCII Linefeed (LF) | |\n+-------------------+-----------------------------------+---------+\n| "\\N{name}" | Character named *name* in the | |\n| | Unicode database (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| "\\r" | ASCII Carriage Return (CR) | |\n+-------------------+-----------------------------------+---------+\n| "\\t" | ASCII Horizontal Tab (TAB) | |\n+-------------------+-----------------------------------+---------+\n| "\\uxxxx" | Character with 16-bit hex value | (1) |\n| | *xxxx* (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| "\\Uxxxxxxxx" | Character with 32-bit hex value | (2) |\n| | *xxxxxxxx* (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| "\\v" | ASCII Vertical Tab (VT) | |\n+-------------------+-----------------------------------+---------+\n| "\\ooo" | Character with octal value *ooo* | (3,5) |\n+-------------------+-----------------------------------+---------+\n| "\\xhh" | Character with hex value *hh* | (4,5) |\n+-------------------+-----------------------------------+---------+\n\nNotes:\n\n1. Individual code units which form parts of a surrogate pair can\nbe encoded using this escape sequence.\n\n2. Any Unicode character can be encoded this way, but characters\noutside the Basic Multilingual Plane (BMP) will be encoded using a\nsurrogate pair if Python is compiled to use 16-bit code units (the\ndefault).\n\n3. As in Standard C, up to three octal digits are accepted.\n\n4. Unlike in Standard C, exactly two hex digits are required.\n\n5. In a string literal, hexadecimal and octal escapes denote the\nbyte with the given value; it is not necessary that the byte\nencodes a character in the source character set. In a Unicode\nliteral, these escapes denote a Unicode character with the given\nvalue.\n\nUnlike Standard C, all unrecognized escape sequences are left in the\nstring unchanged, i.e., *the backslash is left in the string*. (This\nbehavior is useful when debugging: if an escape sequence is mistyped,\nthe resulting output is more easily recognized as broken.) It is also\nimportant to note that the escape sequences marked as "(Unicode only)"\nin the table above fall into the category of unrecognized escapes for\nnon-Unicode string literals.\n\nWhen an "\'r\'" or "\'R\'" prefix is present, a character following a\nbackslash is included in the string without change, and *all\nbackslashes are left in the string*. For example, the string literal\n"r"\\n"" consists of two characters: a backslash and a lowercase "\'n\'".\nString quotes can be escaped with a backslash, but the backslash\nremains in the string; for example, "r"\\""" is a valid string literal\nconsisting of two characters: a backslash and a double quote; "r"\\""\nis not a valid string literal (even a raw string cannot end in an odd\nnumber of backslashes). Specifically, *a raw string cannot end in a\nsingle backslash* (since the backslash would escape the following\nquote character). Note also that a single backslash followed by a\nnewline is interpreted as those two characters as part of the string,\n*not* as a line continuation.\n\nWhen an "\'r\'" or "\'R\'" prefix is used in conjunction with a "\'u\'" or\n"\'U\'" prefix, then the "\\uXXXX" and "\\UXXXXXXXX" escape sequences are\nprocessed while *all other backslashes are left in the string*. For\nexample, the string literal "ur"\\u0062\\n"" consists of three Unicode\ncharacters:\'LATIN SMALL LETTER B\',\'REVERSE SOLIDUS\', and\'LATIN\nSMALL LETTER N\'. Backslashes can be escaped with a preceding\nbackslash; however, both remain in the string. As a result, "\\uXXXX"\nescape sequences are only recognized when there are an odd number of\nbackslashes.\n',
67'subscriptions': u'\nSubscriptions\n*************\n\nA subscription selects an item of a sequence (string, tuple or list)\nor mapping (dictionary) object:\n\nsubscription ::= primary "[" expression_list "]"\n\nThe primary must evaluate to an object of a sequence or mapping type.\n\nIf the primary is a mapping, the expression list must evaluate to an\nobject whose value is one of the keys of the mapping, and the\nsubscription selects the value in the mapping that corresponds to that\nkey. (The expression list is a tuple except if it has exactly one\nitem.)\n\nIf the primary is a sequence, the expression (list) must evaluate to a\nplain integer. If this value is negative, the length of the sequence\nis added to it (so that, e.g., "x[-1]" selects the last item of "x".)\nThe resulting value must be a nonnegative integer less than the number\nof items in the sequence, and the subscription selects the item whose\nindex is that value (counting from zero).\n\nA string\'s items are characters. A character is not a separate data\ntype but a string of exactly one character.\n',
68'truth': u'\nTruth Value Testing\n*******************\n\nAny object can be tested for truth value, for use in an "if" or\n"while" condition or as operand of the Boolean operations below. The\nfollowing values are considered false:\n\n* "None"\n\n* "False"\n\n* zero of any numeric type, for example, "0", "0L", "0.0", "0j".\n\n* any empty sequence, for example, "\'\'", "()", "[]".\n\n* any empty mapping, for example, "{}".\n\n* instances of user-defined classes, if the class defines a\n"__nonzero__()" or "__len__()" method, when that method returns the\ninteger zero or "bool" value "False". [1]\n\nAll other values are considered true --- so objects of many types are\nalways true.\n\nOperations and built-in functions that have a Boolean result always\nreturn "0" or "False" for false and "1" or "True" for true, unless\notherwise stated. (Important exception: the Boolean operations "or"\nand "and" always return one of their operands.)\n',
69'try': u'\nThe "try" statement\n*******************\n\nThe "try" statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\ntry_stmt ::= try1_stmt | try2_stmt\ntry1_stmt ::= "try" ":" suite\n("except" [expression [("as" | ",") identifier]] ":" suite)+\n["else" ":" suite]\n["finally" ":" suite]\ntry2_stmt ::= "try" ":" suite\n"finally" ":" suite\n\nChanged in version 2.5: In previous versions of Python,\n"try"..."except"..."finally" did not work. "try"..."except" had to be\nnested in "try"..."finally".\n\nThe "except" clause(s) specify one or more exception handlers. When no\nexception occurs in the "try" clause, no exception handler is\nexecuted. When an exception occurs in the "try" suite, a search for an\nexception handler is started. This search inspects the except clauses\nin turn until one is found that matches the exception. An expression-\nless except clause, if present, must be last; it matches any\nexception. For an except clause with an expression, that expression\nis evaluated, and the clause matches the exception if the resulting\nobject is "compatible" with the exception. An object is compatible\nwith an exception if it is the class or a base class of the exception\nobject, or a tuple containing an item compatible with the exception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire "try" statement raised\nthe exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified in that except clause, if present, and the except\nclause\'s suite is executed. All except clauses must have an\nexecutable block. When the end of this block is reached, execution\ncontinues normally after the entire try statement. (This means that\nif two nested handlers exist for the same exception, and the exception\noccurs in the try clause of the inner handler, the outer handler will\nnot handle the exception.)\n\nBefore an except clause\'s suite is executed, details about the\nexception are assigned to three variables in the "sys" module:\n"sys.exc_type" receives the object identifying the exception;\n"sys.exc_value" receives the exception\'s parameter;\n"sys.exc_traceback" receives a traceback object (see section The\nstandard type hierarchy) identifying the point in the program where\nthe exception occurred. These details are also available through the\n"sys.exc_info()" function, which returns a tuple "(exc_type,\nexc_value, exc_traceback)". Use of the corresponding variables is\ndeprecated in favor of this function, since their use is unsafe in a\nthreaded program. As of Python 1.5, the variables are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional "else" clause is executed if and when control flows off\nthe end of the "try" clause. [2] Exceptions in the "else" clause are\nnot handled by the preceding "except" clauses.\n\nIf "finally" is present, it specifies a\'cleanup\'handler. The "try"\nclause is executed, including any "except" and "else" clauses. If an\nexception occurs in any of the clauses and is not handled, the\nexception is temporarily saved. The "finally" clause is executed. If\nthere is a saved exception, it is re-raised at the end of the\n"finally" clause. If the "finally" clause raises another exception or\nexecutes a "return" or "break" statement, the saved exception is\ndiscarded:\n\n>>> def f():\n... try:\n... 1/0\n... finally:\n... return 42\n...\n>>> f()\n42\n\nThe exception information is not available to the program during\nexecution of the "finally" clause.\n\nWhen a "return", "break" or "continue" statement is executed in the\n"try" suite of a "try"..."finally" statement, the "finally" clause is\nalso executed\'on the way out.\'A "continue" statement is illegal in\nthe "finally" clause. (The reason is a problem with the current\nimplementation --- this restriction may be lifted in the future).\n\nThe return value of a function is determined by the last "return"\nstatement executed. Since the "finally" clause always executes, a\n"return" statement executed in the "finally" clause will always be the\nlast one executed:\n\n>>> def foo():\n... try:\n... return\'try\'\n... finally:\n... return\'finally\'\n...\n>>> foo()\n \'finally\'\n\nAdditional information on exceptions can be found in section\nExceptions, and information on using the "raise" statement to generate\nexceptions may be found in section The raise statement.\n',
70'types': u'\nThe standard type hierarchy\n***************************\n\nBelow is a list of the types that are built into Python. Extension\nmodules (written in C, Java, or other languages, depending on the\nimplementation) can define additional types. Future versions of\nPython may add types to the type hierarchy (e.g., rational numbers,\nefficiently stored arrays of integers, etc.).\n\nSome of the type descriptions below contain a paragraph listing\n\'special attributes.\'These are attributes that provide access to the\nimplementation and are not intended for general use. Their definition\nmay change in the future.\n\nNone\nThis type has a single value. There is a single object with this\nvalue. This object is accessed through the built-in name "None". It\nis used to signify the absence of a value in many situations, e.g.,\nit is returned from functions that don\'t explicitly return\nanything. Its truth value is false.\n\nNotImplemented\nThis type has a single value. There is a single object with this\nvalue. This object is accessed through the built-in name\n"NotImplemented". Numeric methods and rich comparison methods may\nreturn this value if they do not implement the operation for the\noperands provided. (The interpreter will then try the reflected\noperation, or some other fallback, depending on the operator.) Its\ntruth value is true.\n\nEllipsis\nThis type has a single value. There is a single object with this\nvalue. This object is accessed through the built-in name\n"Ellipsis". It is used to indicate the presence of the "..." syntax\nin a slice. Its truth value is true.\n\n"numbers.Number"\nThese are created by numeric literals and returned as results by\narithmetic operators and arithmetic built-in functions. Numeric\nobjects are immutable; once created their value never changes.\nPython numbers are of course strongly related to mathematical\nnumbers, but subject to the limitations of numerical representation\nin computers.\n\nPython distinguishes between integers, floating point numbers, and\ncomplex numbers:\n\n"numbers.Integral"\nThese represent elements from the mathematical set of integers\n(positive and negative).\n\nThere are three types of integers:\n\nPlain integers\nThese represent numbers in the range -2147483648 through\n2147483647. (The range may be larger on machines with a\nlarger natural word size, but not smaller.) When the result\nof an operation would fall outside this range, the result is\nnormally returned as a long integer (in some cases, the\nexception "OverflowError" is raised instead). For the\npurpose of shift and mask operations, integers are assumed to\nhave a binary, 2\'s complement notation using 32 or more bits,\nand hiding no bits from the user (i.e., all 4294967296\ndifferent bit patterns correspond to different values).\n\nLong integers\nThese represent numbers in an unlimited range, subject to\navailable (virtual) memory only. For the purpose of shift\nand mask operations, a binary representation is assumed, and\nnegative numbers are represented in a variant of 2\'s\ncomplement which gives the illusion of an infinite string of\nsign bits extending to the left.\n\nBooleans\nThese represent the truth values False and True. The two\nobjects representing the values "False" and "True" are the\nonly Boolean objects. The Boolean type is a subtype of plain\nintegers, and Boolean values behave like the values 0 and 1,\nrespectively, in almost all contexts, the exception being\nthat when converted to a string, the strings ""False"" or\n""True"" are returned, respectively.\n\nThe rules for integer representation are intended to give the\nmost meaningful interpretation of shift and mask operations\ninvolving negative integers and the least surprises when\nswitching between the plain and long integer domains. Any\noperation, if it yields a result in the plain integer domain,\nwill yield the same result in the long integer domain or when\nusing mixed operands. The switch between domains is transparent\nto the programmer.\n\n"numbers.Real" ("float")\nThese represent machine-level double precision floating point\nnumbers. You are at the mercy of the underlying machine\narchitecture (and C or Java implementation) for the accepted\nrange and handling of overflow. Python does not support single-\nprecision floating point numbers; the savings in processor and\nmemory usage that are usually the reason for using these are\ndwarfed by the overhead of using objects in Python, so there is\nno reason to complicate the language with two kinds of floating\npoint numbers.\n\n"numbers.Complex"\nThese represent complex numbers as a pair of machine-level\ndouble precision floating point numbers. The same caveats apply\nas for floating point numbers. The real and imaginary parts of a\ncomplex number "z" can be retrieved through the read-only\nattributes "z.real" and "z.imag".\n\nSequences\nThese represent finite ordered sets indexed by non-negative\nnumbers. The built-in function "len()" returns the number of items\nof a sequence. When the length of a sequence is *n*, the index set\ncontains the numbers 0, 1, ..., *n*-1. Item *i* of sequence *a* is\nselected by "a[i]".\n\nSequences also support slicing: "a[i:j]" selects all items with\nindex *k* such that *i* "<=" *k* "<" *j*. When used as an\nexpression, a slice is a sequence of the same type. This implies\nthat the index set is renumbered so that it starts at 0.\n\nSome sequences also support "extended slicing" with a third "step"\nparameter: "a[i:j:k]" selects all items of *a* with index *x* where\n"x = i + n*k", *n* ">=" "0" and *i* "<=" *x* "<" *j*.\n\nSequences are distinguished according to their mutability:\n\nImmutable sequences\nAn object of an immutable sequence type cannot change once it is\ncreated. (If the object contains references to other objects,\nthese other objects may be mutable and may be changed; however,\nthe collection of objects directly referenced by an immutable\nobject cannot change.)\n\nThe following types are immutable sequences:\n\nStrings\nThe items of a string are characters. There is no separate\ncharacter type; a character is represented by a string of one\nitem. Characters represent (at least) 8-bit bytes. The\nbuilt-in functions "chr()" and "ord()" convert between\ncharacters and nonnegative integers representing the byte\nvalues. Bytes with the values 0-127 usually represent the\ncorresponding ASCII values, but the interpretation of values\nis up to the program. The string data type is also used to\nrepresent arrays of bytes, e.g., to hold data read from a\nfile.\n\n(On systems whose native character set is not ASCII, strings\nmay use EBCDIC in their internal representation, provided the\nfunctions "chr()" and "ord()" implement a mapping between\nASCII and EBCDIC, and string comparison preserves the ASCII\norder. Or perhaps someone can propose a better rule?)\n\nUnicode\nThe items of a Unicode object are Unicode code units. A\nUnicode code unit is represented by a Unicode object of one\nitem and can hold either a 16-bit or 32-bit value\nrepresenting a Unicode ordinal (the maximum value for the\nordinal is given in "sys.maxunicode", and depends on how\nPython is configured at compile time). Surrogate pairs may\nbe present in the Unicode object, and will be reported as two\nseparate items. The built-in functions "unichr()" and\n"ord()" convert between code units and nonnegative integers\nrepresenting the Unicode ordinals as defined in the Unicode\nStandard 3.0. Conversion from and to other encodings are\npossible through the Unicode method "encode()" and the built-\nin function "unicode()".\n\nTuples\nThe items of a tuple are arbitrary Python objects. Tuples of\ntwo or more items are formed by comma-separated lists of\nexpressions. A tuple of one item (a\'singleton\') can be\nformed by affixing a comma to an expression (an expression by\nitself does not create a tuple, since parentheses must be\nusable for grouping of expressions). An empty tuple can be\nformed by an empty pair of parentheses.\n\nMutable sequences\nMutable sequences can be changed after they are created. The\nsubscription and slicing notations can be used as the target of\nassignment and "del" (delete) statements.\n\nThere are currently two intrinsic mutable sequence types:\n\nLists\nThe items of a list are arbitrary Python objects. Lists are\nformed by placing a comma-separated list of expressions in\nsquare brackets. (Note that there are no special cases needed\nto form lists of length 0 or 1.)\n\nByte Arrays\nA bytearray object is a mutable array. They are created by\nthe built-in "bytearray()" constructor. Aside from being\nmutable (and hence unhashable), byte arrays otherwise provide\nthe same interface and functionality as immutable bytes\nobjects.\n\nThe extension module "array" provides an additional example of a\nmutable sequence type.\n\nSet types\nThese represent unordered, finite sets of unique, immutable\nobjects. As such, they cannot be indexed by any subscript. However,\nthey can be iterated over, and the built-in function "len()"\nreturns the number of items in a set. Common uses for sets are fast\nmembership testing, removing duplicates from a sequence, and\ncomputing mathematical operations such as intersection, union,\ndifference, and symmetric difference.\n\nFor set elements, the same immutability rules apply as for\ndictionary keys. Note that numeric types obey the normal rules for\nnumeric comparison: if two numbers compare equal (e.g., "1" and\n"1.0"), only one of them can be contained in a set.\n\nThere are currently two intrinsic set types:\n\nSets\nThese represent a mutable set. They are created by the built-in\n"set()" constructor and can be modified afterwards by several\nmethods, such as "add()".\n\nFrozen sets\nThese represent an immutable set. They are created by the\nbuilt-in "frozenset()" constructor. As a frozenset is immutable\nand *hashable*, it can be used again as an element of another\nset, or as a dictionary key.\n\nMappings\nThese represent finite sets of objects indexed by arbitrary index\nsets. The subscript notation "a[k]" selects the item indexed by "k"\nfrom the mapping "a"; this can be used in expressions and as the\ntarget of assignments or "del" statements. The built-in function\n"len()" returns the number of items in a mapping.\n\nThere is currently a single intrinsic mapping type:\n\nDictionaries\nThese represent finite sets of objects indexed by nearly\narbitrary values. The only types of values not acceptable as\nkeys are values containing lists or dictionaries or other\nmutable types that are compared by value rather than by object\nidentity, the reason being that the efficient implementation of\ndictionaries requires a key\'s hash value to remain constant.\nNumeric types used for keys obey the normal rules for numeric\ncomparison: if two numbers compare equal (e.g., "1" and "1.0")\nthen they can be used interchangeably to index the same\ndictionary entry.\n\nDictionaries are mutable; they can be created by the "{...}"\nnotation (see section Dictionary displays).\n\nThe extension modules "dbm", "gdbm", and "bsddb" provide\nadditional examples of mapping types.\n\nCallable types\nThese are the types to which the function call operation (see\nsection Calls) can be applied:\n\nUser-defined functions\nA user-defined function object is created by a function\ndefinition (see section Function definitions). It should be\ncalled with an argument list containing the same number of items\nas the function\'s formal parameter list.\n\nSpecial attributes:\n\n+-------------------------+---------------------------------+-------------+\n| Attribute | Meaning | |\n+=========================+=================================+=============+\n| "__doc__" "func_doc" | The function\'s documentation | Writable |\n| | string, or "None" if | |\n| | unavailable. | |\n+-------------------------+---------------------------------+-------------+\n| "__name__" "func_name" | The function\'s name. | Writable |\n+-------------------------+---------------------------------+-------------+\n| "__module__" | The name of the module the | Writable |\n| | function was defined in, or | |\n| | "None" if unavailable. | |\n+-------------------------+---------------------------------+-------------+\n| "__defaults__" | A tuple containing default | Writable |\n| "func_defaults" | argument values for those | |\n| | arguments that have defaults, | |\n| | or "None" if no arguments have | |\n| | a default value. | |\n+-------------------------+---------------------------------+-------------+\n| "__code__" "func_code" | The code object representing | Writable |\n| | the compiled function body. | |\n+-------------------------+---------------------------------+-------------+\n| "__globals__" | A reference to the dictionary | Read-only |\n| "func_globals" | that holds the function\'s | |\n| | global variables --- the global | |\n| | namespace of the module in | |\n| | which the function was defined. | |\n+-------------------------+---------------------------------+-------------+\n| "__dict__" "func_dict" | The namespace supporting | Writable |\n| | arbitrary function attributes. | |\n+-------------------------+---------------------------------+-------------+\n| "__closure__" | "None" or a tuple of cells that | Read-only |\n| "func_closure" | contain bindings for the | |\n| | function\'s free variables. | |\n+-------------------------+---------------------------------+-------------+\n\nMost of the attributes labelled "Writable" check the type of the\nassigned value.\n\nChanged in version 2.4: "func_name" is now writable.\n\nChanged in version 2.6: The double-underscore attributes\n"__closure__", "__code__", "__defaults__", and "__globals__"\nwere introduced as aliases for the corresponding "func_*"\nattributes for forwards compatibility with Python 3.\n\nFunction objects also support getting and setting arbitrary\nattributes, which can be used, for example, to attach metadata\nto functions. Regular attribute dot-notation is used to get and\nset such attributes. *Note that the current implementation only\nsupports function attributes on user-defined functions. Function\nattributes on built-in functions may be supported in the\nfuture.*\n\nAdditional information about a function\'s definition can be\nretrieved from its code object; see the description of internal\ntypes below.\n\nUser-defined methods\nA user-defined method object combines a class, a class instance\n(or "None") and any callable object (normally a user-defined\nfunction).\n\nSpecial read-only attributes: "im_self" is the class instance\nobject, "im_func" is the function object; "im_class" is the\nclass of "im_self" for bound methods or the class that asked for\nthe method for unbound methods; "__doc__" is the method\'s\ndocumentation (same as "im_func.__doc__"); "__name__" is the\nmethod name (same as "im_func.__name__"); "__module__" is the\nname of the module the method was defined in, or "None" if\nunavailable.\n\nChanged in version 2.2: "im_self" used to refer to the class\nthat defined the method.\n\nChanged in version 2.6: For Python 3 forward-compatibility,\n"im_func" is also available as "__func__", and "im_self" as\n"__self__".\n\nMethods also support accessing (but not setting) the arbitrary\nfunction attributes on the underlying function object.\n\nUser-defined method objects may be created when getting an\nattribute of a class (perhaps via an instance of that class), if\nthat attribute is a user-defined function object, an unbound\nuser-defined method object, or a class method object. When the\nattribute is a user-defined method object, a new method object\nis only created if the class from which it is being retrieved is\nthe same as, or a derived class of, the class stored in the\noriginal method object; otherwise, the original method object is\nused as it is.\n\nWhen a user-defined method object is created by retrieving a\nuser-defined function object from a class, its "im_self"\nattribute is "None" and the method object is said to be unbound.\nWhen one is created by retrieving a user-defined function object\nfrom a class via one of its instances, its "im_self" attribute\nis the instance, and the method object is said to be bound. In\neither case, the new method\'s "im_class" attribute is the class\nfrom which the retrieval takes place, and its "im_func"\nattribute is the original function object.\n\nWhen a user-defined method object is created by retrieving\nanother method object from a class or instance, the behaviour is\nthe same as for a function object, except that the "im_func"\nattribute of the new instance is not the original method object\nbut its "im_func" attribute.\n\nWhen a user-defined method object is created by retrieving a\nclass method object from a class or instance, its "im_self"\nattribute is the class itself, and its "im_func" attribute is\nthe function object underlying the class method.\n\nWhen an unbound user-defined method object is called, the\nunderlying function ("im_func") is called, with the restriction\nthat the first argument must be an instance of the proper class\n("im_class") or of a derived class thereof.\n\nWhen a bound user-defined method object is called, the\nunderlying function ("im_func") is called, inserting the class\ninstance ("im_self") in front of the argument list. For\ninstance, when "C" is a class which contains a definition for a\nfunction "f()", and "x" is an instance of "C", calling "x.f(1)"\nis equivalent to calling "C.f(x, 1)".\n\nWhen a user-defined method object is derived from a class method\nobject, the "class instance" stored in "im_self" will actually\nbe the class itself, so that calling either "x.f(1)" or "C.f(1)"\nis equivalent to calling "f(C,1)" where "f" is the underlying\nfunction.\n\nNote that the transformation from function object to (unbound or\nbound) method object happens each time the attribute is\nretrieved from the class or instance. In some cases, a fruitful\noptimization is to assign the attribute to a local variable and\ncall that local variable. Also notice that this transformation\nonly happens for user-defined functions; other callable objects\n(and all non-callable objects) are retrieved without\ntransformation. It is also important to note that user-defined\nfunctions which are attributes of a class instance are not\nconverted to bound methods; this *only* happens when the\nfunction is an attribute of the class.\n\nGenerator functions\nA function or method which uses the "yield" statement (see\nsection The yield statement) is called a *generator function*.\nSuch a function, when called, always returns an iterator object\nwhich can be used to execute the body of the function: calling\nthe iterator\'s "next()" method will cause the function to\nexecute until it provides a value using the "yield" statement.\nWhen the function executes a "return" statement or falls off the\nend, a "StopIteration" exception is raised and the iterator will\nhave reached the end of the set of values to be returned.\n\nBuilt-in functions\nA built-in function object is a wrapper around a C function.\nExamples of built-in functions are "len()" and "math.sin()"\n("math" is a standard built-in module). The number and type of\nthe arguments are determined by the C function. Special read-\nonly attributes: "__doc__" is the function\'s documentation\nstring, or "None" if unavailable; "__name__" is the function\'s\nname; "__self__" is set to "None" (but see the next item);\n"__module__" is the name of the module the function was defined\nin or "None" if unavailable.\n\nBuilt-in methods\nThis is really a different disguise of a built-in function, this\ntime containing an object passed to the C function as an\nimplicit extra argument. An example of a built-in method is\n"alist.append()", assuming *alist* is a list object. In this\ncase, the special read-only attribute "__self__" is set to the\nobject denoted by *alist*.\n\nClass Types\nClass types, or "new-style classes," are callable. These\nobjects normally act as factories for new instances of\nthemselves, but variations are possible for class types that\noverride "__new__()". The arguments of the call are passed to\n"__new__()" and, in the typical case, to "__init__()" to\ninitialize the new instance.\n\nClassic Classes\nClass objects are described below. When a class object is\ncalled, a new class instance (also described below) is created\nand returned. This implies a call to the class\'s "__init__()"\nmethod if it has one. Any arguments are passed on to the\n"__init__()" method. If there is no "__init__()" method, the\nclass must be called without arguments.\n\nClass instances\nClass instances are described below. Class instances are\ncallable only when the class has a "__call__()" method;\n"x(arguments)" is a shorthand for "x.__call__(arguments)".\n\nModules\nModules are imported by the "import" statement (see section The\nimport statement). A module object has a namespace implemented by a\ndictionary object (this is the dictionary referenced by the\nfunc_globals attribute of functions defined in the module).\nAttribute references are translated to lookups in this dictionary,\ne.g., "m.x" is equivalent to "m.__dict__["x"]". A module object\ndoes not contain the code object used to initialize the module\n(since it isn\'t needed once the initialization is done).\n\nAttribute assignment updates the module\'s namespace dictionary,\ne.g., "m.x = 1" is equivalent to "m.__dict__["x"] = 1".\n\nSpecial read-only attribute: "__dict__" is the module\'s namespace\nas a dictionary object.\n\n**CPython implementation detail:** Because of the way CPython\nclears module dictionaries, the module dictionary will be cleared\nwhen the module falls out of scope even if the dictionary still has\nlive references. To avoid this, copy the dictionary or keep the\nmodule around while using its dictionary directly.\n\nPredefined (writable) attributes: "__name__" is the module\'s name;\n"__doc__" is the module\'s documentation string, or "None" if\nunavailable; "__file__" is the pathname of the file from which the\nmodule was loaded, if it was loaded from a file. The "__file__"\nattribute is not present for C modules that are statically linked\ninto the interpreter; for extension modules loaded dynamically from\na shared library, it is the pathname of the shared library file.\n\nClasses\nBoth class types (new-style classes) and class objects (old-\nstyle/classic classes) are typically created by class definitions\n(see section Class definitions). A class has a namespace\nimplemented by a dictionary object. Class attribute references are\ntranslated to lookups in this dictionary, e.g., "C.x" is translated\nto "C.__dict__["x"]" (although for new-style classes in particular\nthere are a number of hooks which allow for other means of locating\nattributes). When the attribute name is not found there, the\nattribute search continues in the base classes. For old-style\nclasses, the search is depth-first, left-to-right in the order of\noccurrence in the base class list. New-style classes use the more\ncomplex C3 method resolution order which behaves correctly even in\nthe presence of\'diamond\'inheritance structures where there are\nmultiple inheritance paths leading back to a common ancestor.\nAdditional details on the C3 MRO used by new-style classes can be\nfound in the documentation accompanying the 2.3 release at\nhttps://www.python.org/download/releases/2.3/mro/.\n\nWhen a class attribute reference (for class "C", say) would yield a\nuser-defined function object or an unbound user-defined method\nobject whose associated class is either "C" or one of its base\nclasses, it is transformed into an unbound user-defined method\nobject whose "im_class" attribute is "C". When it would yield a\nclass method object, it is transformed into a bound user-defined\nmethod object whose "im_self" attribute is "C". When it would\nyield a static method object, it is transformed into the object\nwrapped by the static method object. See section Implementing\nDescriptors for another way in which attributes retrieved from a\nclass may differ from those actually contained in its "__dict__"\n(note that only new-style classes support descriptors).\n\nClass attribute assignments update the class\'s dictionary, never\nthe dictionary of a base class.\n\nA class object can be called (see above) to yield a class instance\n(see below).\n\nSpecial attributes: "__name__" is the class name; "__module__" is\nthe module name in which the class was defined; "__dict__" is the\ndictionary containing the class\'s namespace; "__bases__" is a tuple\n(possibly empty or a singleton) containing the base classes, in the\norder of their occurrence in the base class list; "__doc__" is the\nclass\'s documentation string, or None if undefined.\n\nClass instances\nA class instance is created by calling a class object (see above).\nA class instance has a namespace implemented as a dictionary which\nis the first place in which attribute references are searched.\nWhen an attribute is not found there, and the instance\'s class has\nan attribute by that name, the search continues with the class\nattributes. If a class attribute is found that is a user-defined\nfunction object or an unbound user-defined method object whose\nassociated class is the class (call it "C") of the instance for\nwhich the attribute reference was initiated or one of its bases, it\nis transformed into a bound user-defined method object whose\n"im_class" attribute is "C" and whose "im_self" attribute is the\ninstance. Static method and class method objects are also\ntransformed, as if they had been retrieved from class "C"; see\nabove under "Classes". See section Implementing Descriptors for\nanother way in which attributes of a class retrieved via its\ninstances may differ from the objects actually stored in the\nclass\'s "__dict__". If no class attribute is found, and the\nobject\'s class has a "__getattr__()" method, that is called to\nsatisfy the lookup.\n\nAttribute assignments and deletions update the instance\'s\ndictionary, never a class\'s dictionary. If the class has a\n"__setattr__()" or "__delattr__()" method, this is called instead\nof updating the instance dictionary directly.\n\nClass instances can pretend to be numbers, sequences, or mappings\nif they have methods with certain special names. See section\nSpecial method names.\n\nSpecial attributes: "__dict__" is the attribute dictionary;\n"__class__" is the instance\'s class.\n\nFiles\nA file object represents an open file. File objects are created by\nthe "open()" built-in function, and also by "os.popen()",\n"os.fdopen()", and the "makefile()" method of socket objects (and\nperhaps by other functions or methods provided by extension\nmodules). The objects "sys.stdin", "sys.stdout" and "sys.stderr"\nare initialized to file objects corresponding to the interpreter\'s\nstandard input, output and error streams. See File Objects for\ncomplete documentation of file objects.\n\nInternal types\nA few types used internally by the interpreter are exposed to the\nuser. Their definitions may change with future versions of the\ninterpreter, but they are mentioned here for completeness.\n\nCode objects\nCode objects represent *byte-compiled* executable Python code,\nor *bytecode*. The difference between a code object and a\nfunction object is that the function object contains an explicit\nreference to the function\'s globals (the module in which it was\ndefined), while a code object contains no context; also the\ndefault argument values are stored in the function object, not\nin the code object (because they represent values calculated at\nrun-time). Unlike function objects, code objects are immutable\nand contain no references (directly or indirectly) to mutable\nobjects.\n\nSpecial read-only attributes: "co_name" gives the function name;\n"co_argcount" is the number of positional arguments (including\narguments with default values); "co_nlocals" is the number of\nlocal variables used by the function (including arguments);\n"co_varnames" is a tuple containing the names of the local\nvariables (starting with the argument names); "co_cellvars" is a\ntuple containing the names of local variables that are\nreferenced by nested functions; "co_freevars" is a tuple\ncontaining the names of free variables; "co_code" is a string\nrepresenting the sequence of bytecode instructions; "co_consts"\nis a tuple containing the literals used by the bytecode;\n"co_names" is a tuple containing the names used by the bytecode;\n"co_filename" is the filename from which the code was compiled;\n"co_firstlineno" is the first line number of the function;\n"co_lnotab" is a string encoding the mapping from bytecode\noffsets to line numbers (for details see the source code of the\ninterpreter); "co_stacksize" is the required stack size\n(including local variables); "co_flags" is an integer encoding a\nnumber of flags for the interpreter.\n\nThe following flag bits are defined for "co_flags": bit "0x04"\nis set if the function uses the "*arguments" syntax to accept an\narbitrary number of positional arguments; bit "0x08" is set if\nthe function uses the "**keywords" syntax to accept arbitrary\nkeyword arguments; bit "0x20" is set if the function is a\ngenerator.\n\nFuture feature declarations ("from __future__ import division")\nalso use bits in "co_flags" to indicate whether a code object\nwas compiled with a particular feature enabled: bit "0x2000" is\nset if the function was compiled with future division enabled;\nbits "0x10" and "0x1000" were used in earlier versions of\nPython.\n\nOther bits in "co_flags" are reserved for internal use.\n\nIf a code object represents a function, the first item in\n"co_consts" is the documentation string of the function, or\n"None" if undefined.\n\nFrame objects\nFrame objects represent execution frames. They may occur in\ntraceback objects (see below).\n\nSpecial read-only attributes: "f_back" is to the previous stack\nframe (towards the caller), or "None" if this is the bottom\nstack frame; "f_code" is the code object being executed in this\nframe; "f_locals" is the dictionary used to look up local\nvariables; "f_globals" is used for global variables;\n"f_builtins" is used for built-in (intrinsic) names;\n"f_restricted" is a flag indicating whether the function is\nexecuting in restricted execution mode; "f_lasti" gives the\nprecise instruction (this is an index into the bytecode string\nof the code object).\n\nSpecial writable attributes: "f_trace", if not "None", is a\nfunction called at the start of each source code line (this is\nused by the debugger); "f_exc_type", "f_exc_value",\n"f_exc_traceback" represent the last exception raised in the\nparent frame provided another exception was ever raised in the\ncurrent frame (in all other cases they are None); "f_lineno" is\nthe current line number of the frame --- writing to this from\nwithin a trace function jumps to the given line (only for the\nbottom-most frame). A debugger can implement a Jump command\n(aka Set Next Statement) by writing to f_lineno.\n\nTraceback objects\nTraceback objects represent a stack trace of an exception. A\ntraceback object is created when an exception occurs. When the\nsearch for an exception handler unwinds the execution stack, at\neach unwound level a traceback object is inserted in front of\nthe current traceback. When an exception handler is entered,\nthe stack trace is made available to the program. (See section\nThe try statement.) It is accessible as "sys.exc_traceback", and\nalso as the third item of the tuple returned by\n"sys.exc_info()". The latter is the preferred interface, since\nit works correctly when the program is using multiple threads.\nWhen the program contains no suitable handler, the stack trace\nis written (nicely formatted) to the standard error stream; if\nthe interpreter is interactive, it is also made available to the\nuser as "sys.last_traceback".\n\nSpecial read-only attributes: "tb_next" is the next level in the\nstack trace (towards the frame where the exception occurred), or\n"None" if there is no next level; "tb_frame" points to the\nexecution frame of the current level; "tb_lineno" gives the line\nnumber where the exception occurred; "tb_lasti" indicates the\nprecise instruction. The line number and last instruction in\nthe traceback may differ from the line number of its frame\nobject if the exception occurred in a "try" statement with no\nmatching except clause or with a finally clause.\n\nSlice objects\nSlice objects are used to represent slices when *extended slice\nsyntax* is used. This is a slice using two colons, or multiple\nslices or ellipses separated by commas, e.g., "a[i:j:step]",\n"a[i:j, k:l]", or "a[..., i:j]". They are also created by the\nbuilt-in "slice()" function.\n\nSpecial read-only attributes: "start" is the lower bound; "stop"\nis the upper bound; "step" is the step value; each is "None" if\nomitted. These attributes can have any type.\n\nSlice objects support one method:\n\nslice.indices(self, length)\n\nThis method takes a single integer argument *length* and\ncomputes information about the extended slice that the slice\nobject would describe if applied to a sequence of *length*\nitems. It returns a tuple of three integers; respectively\nthese are the *start* and *stop* indices and the *step* or\nstride length of the slice. Missing or out-of-bounds indices\nare handled in a manner consistent with regular slices.\n\nNew in version 2.3.\n\nStatic method objects\nStatic method objects provide a way of defeating the\ntransformation of function objects to method objects described\nabove. A static method object is a wrapper around any other\nobject, usually a user-defined method object. When a static\nmethod object is retrieved from a class or a class instance, the\nobject actually returned is the wrapped object, which is not\nsubject to any further transformation. Static method objects are\nnot themselves callable, although the objects they wrap usually\nare. Static method objects are created by the built-in\n"staticmethod()" constructor.\n\nClass method objects\nA class method object, like a static method object, is a wrapper\naround another object that alters the way in which that object\nis retrieved from classes and class instances. The behaviour of\nclass method objects upon such retrieval is described above,\nunder "User-defined methods". Class method objects are created\nby the built-in "classmethod()" constructor.\n',
71'typesfunctions': u'\nFunctions\n*********\n\nFunction objects are created by function definitions. The only\noperation on a function object is to call it: "func(argument-list)".\n\nThere are really two flavors of function objects: built-in functions\nand user-defined functions. Both support the same operation (to call\nthe function), but the implementation is different, hence the\ndifferent object types.\n\nSee Function definitions for more information.\n',
72'typesmapping': u'\nMapping Types --- "dict"\n************************\n\nA *mapping* object maps *hashable* values to arbitrary objects.\nMappings are mutable objects. There is currently only one standard\nmapping type, the *dictionary*. (For other containers see the built\nin "list", "set", and "tuple" classes, and the "collections" module.)\n\nA dictionary\'s keys are *almost* arbitrary values. Values that are\nnot *hashable*, that is, values containing lists, dictionaries or\nother mutable types (that are compared by value rather than by object\nidentity) may not be used as keys. Numeric types used for keys obey\nthe normal rules for numeric comparison: if two numbers compare equal\n(such as "1" and "1.0") then they can be used interchangeably to index\nthe same dictionary entry. (Note however, that since computers store\nfloating-point numbers as approximations it is usually unwise to use\nthem as dictionary keys.)\n\nDictionaries can be created by placing a comma-separated list of "key:\nvalue" pairs within braces, for example: "{\'jack\': 4098,\'sjoerd\':\n4127}" or "{4098:\'jack\', 4127:\'sjoerd\'}", or by the "dict"\nconstructor.\n\nclass class dict(**kwarg)\nclass class dict(mapping, **kwarg)\nclass class dict(iterable, **kwarg)\n\nReturn a new dictionary initialized from an optional positional\nargument and a possibly empty set of keyword arguments.\n\nIf no positional argument is given, an empty dictionary is created.\nIf a positional argument is given and it is a mapping object, a\ndictionary is created with the same key-value pairs as the mapping\nobject. Otherwise, the positional argument must be an *iterable*\nobject. Each item in the iterable must itself be an iterable with\nexactly two objects. The first object of each item becomes a key\nin the new dictionary, and the second object the corresponding\nvalue. If a key occurs more than once, the last value for that key\nbecomes the corresponding value in the new dictionary.\n\nIf keyword arguments are given, the keyword arguments and their\nvalues are added to the dictionary created from the positional\nargument. If a key being added is already present, the value from\nthe keyword argument replaces the value from the positional\nargument.\n\nTo illustrate, the following examples all return a dictionary equal\nto "{"one": 1, "two": 2, "three": 3}":\n\n>>> a = dict(one=1, two=2, three=3)\n>>> b = {\'one\': 1,\'two\': 2,\'three\': 3}\n>>> c = dict(zip([\'one\',\'two\',\'three\'], [1, 2, 3]))\n>>> d = dict([(\'two\', 2), (\'one\', 1), (\'three\', 3)])\n>>> e = dict({\'three\': 3,\'one\': 1,\'two\': 2})\n>>> a == b == c == d == e\nTrue\n\nProviding keyword arguments as in the first example only works for\nkeys that are valid Python identifiers. Otherwise, any valid keys\ncan be used.\n\nNew in version 2.2.\n\nChanged in version 2.3: Support for building a dictionary from\nkeyword arguments added.\n\nThese are the operations that dictionaries support (and therefore,\ncustom mapping types should support too):\n\nlen(d)\n\nReturn the number of items in the dictionary *d*.\n\nd[key]\n\nReturn the item of *d* with key *key*. Raises a "KeyError" if\n*key* is not in the map.\n\nIf a subclass of dict defines a method "__missing__()" and *key*\nis not present, the "d[key]" operation calls that method with\nthe key *key* as argument. The "d[key]" operation then returns\nor raises whatever is returned or raised by the\n"__missing__(key)" call. No other operations or methods invoke\n"__missing__()". If "__missing__()" is not defined, "KeyError"\nis raised. "__missing__()" must be a method; it cannot be an\ninstance variable:\n\n>>> class Counter(dict):\n... def __missing__(self, key):\n... return 0\n>>> c = Counter()\n>>> c[\'red\']\n0\n>>> c[\'red\'] += 1\n>>> c[\'red\']\n1\n\nThe example above shows part of the implementation of\n"collections.Counter". A different "__missing__" method is used\nby "collections.defaultdict".\n\nNew in version 2.5: Recognition of __missing__ methods of dict\nsubclasses.\n\nd[key] = value\n\nSet "d[key]" to *value*.\n\ndel d[key]\n\nRemove "d[key]" from *d*. Raises a "KeyError" if *key* is not\nin the map.\n\nkey in d\n\nReturn "True" if *d* has a key *key*, else "False".\n\nNew in version 2.2.\n\nkey not in d\n\nEquivalent to "not key in d".\n\nNew in version 2.2.\n\niter(d)\n\nReturn an iterator over the keys of the dictionary. This is a\nshortcut for "iterkeys()".\n\nclear()\n\nRemove all items from the dictionary.\n\ncopy()\n\nReturn a shallow copy of the dictionary.\n\nfromkeys(seq[, value])\n\nCreate a new dictionary with keys from *seq* and values set to\n*value*.\n\n"fromkeys()" is a class method that returns a new dictionary.\n*value* defaults to "None".\n\nNew in version 2.3.\n\nget(key[, default])\n\nReturn the value for *key* if *key* is in the dictionary, else\n*default*. If *default* is not given, it defaults to "None", so\nthat this method never raises a "KeyError".\n\nhas_key(key)\n\nTest for the presence of *key* in the dictionary. "has_key()"\nis deprecated in favor of "key in d".\n\nitems()\n\nReturn a copy of the dictionary\'s list of "(key, value)" pairs.\n\n**CPython implementation detail:** Keys and values are listed in\nan arbitrary order which is non-random, varies across Python\nimplementations, and depends on the dictionary\'s history of\ninsertions and deletions.\n\nIf "items()", "keys()", "values()", "iteritems()", "iterkeys()",\nand "itervalues()" are called with no intervening modifications\nto the dictionary, the lists will directly correspond. This\nallows the creation of "(value, key)" pairs using "zip()":\n"pairs = zip(d.values(), d.keys())". The same relationship\nholds for the "iterkeys()" and "itervalues()" methods: "pairs =\nzip(d.itervalues(), d.iterkeys())" provides the same value for\n"pairs". Another way to create the same list is "pairs = [(v, k)\nfor (k, v) in d.iteritems()]".\n\niteritems()\n\nReturn an iterator over the dictionary\'s "(key, value)" pairs.\nSee the note for "dict.items()".\n\nUsing "iteritems()" while adding or deleting entries in the\ndictionary may raise a "RuntimeError" or fail to iterate over\nall entries.\n\nNew in version 2.2.\n\niterkeys()\n\nReturn an iterator over the dictionary\'s keys. See the note for\n"dict.items()".\n\nUsing "iterkeys()" while adding or deleting entries in the\ndictionary may raise a "RuntimeError" or fail to iterate over\nall entries.\n\nNew in version 2.2.\n\nitervalues()\n\nReturn an iterator over the dictionary\'s values. See the note\nfor "dict.items()".\n\nUsing "itervalues()" while adding or deleting entries in the\ndictionary may raise a "RuntimeError" or fail to iterate over\nall entries.\n\nNew in version 2.2.\n\nkeys()\n\nReturn a copy of the dictionary\'s list of keys. See the note\nfor "dict.items()".\n\npop(key[, default])\n\nIf *key* is in the dictionary, remove it and return its value,\nelse return *default*. If *default* is not given and *key* is\nnot in the dictionary, a "KeyError" is raised.\n\nNew in version 2.3.\n\npopitem()\n\nRemove and return an arbitrary "(key, value)" pair from the\ndictionary.\n\n"popitem()" is useful to destructively iterate over a\ndictionary, as often used in set algorithms. If the dictionary\nis empty, calling "popitem()" raises a "KeyError".\n\nsetdefault(key[, default])\n\nIf *key* is in the dictionary, return its value. If not, insert\n*key* with a value of *default* and return *default*. *default*\ndefaults to "None".\n\nupdate([other])\n\nUpdate the dictionary with the key/value pairs from *other*,\noverwriting existing keys. Return "None".\n\n"update()" accepts either another dictionary object or an\niterable of key/value pairs (as tuples or other iterables of\nlength two). If keyword arguments are specified, the dictionary\nis then updated with those key/value pairs: "d.update(red=1,\nblue=2)".\n\nChanged in version 2.4: Allowed the argument to be an iterable\nof key/value pairs and allowed keyword arguments.\n\nvalues()\n\nReturn a copy of the dictionary\'s list of values. See the note\nfor "dict.items()".\n\nviewitems()\n\nReturn a new view of the dictionary\'s items ("(key, value)"\npairs). See below for documentation of view objects.\n\nNew in version 2.7.\n\nviewkeys()\n\nReturn a new view of the dictionary\'s keys. See below for\ndocumentation of view objects.\n\nNew in version 2.7.\n\nviewvalues()\n\nReturn a new view of the dictionary\'s values. See below for\ndocumentation of view objects.\n\nNew in version 2.7.\n\n\nDictionary view objects\n=======================\n\nThe objects returned by "dict.viewkeys()", "dict.viewvalues()" and\n"dict.viewitems()" are *view objects*. They provide a dynamic view on\nthe dictionary\'s entries, which means that when the dictionary\nchanges, the view reflects these changes.\n\nDictionary views can be iterated over to yield their respective data,\nand support membership tests:\n\nlen(dictview)\n\nReturn the number of entries in the dictionary.\n\niter(dictview)\n\nReturn an iterator over the keys, values or items (represented as\ntuples of "(key, value)") in the dictionary.\n\nKeys and values are iterated over in an arbitrary order which is\nnon-random, varies across Python implementations, and depends on\nthe dictionary\'s history of insertions and deletions. If keys,\nvalues and items views are iterated over with no intervening\nmodifications to the dictionary, the order of items will directly\ncorrespond. This allows the creation of "(value, key)" pairs using\n"zip()": "pairs = zip(d.values(), d.keys())". Another way to\ncreate the same list is "pairs = [(v, k) for (k, v) in d.items()]".\n\nIterating views while adding or deleting entries in the dictionary\nmay raise a "RuntimeError" or fail to iterate over all entries.\n\nx in dictview\n\nReturn "True" if *x* is in the underlying dictionary\'s keys, values\nor items (in the latter case, *x* should be a "(key, value)"\ntuple).\n\nKeys views are set-like since their entries are unique and hashable.\nIf all values are hashable, so that (key, value) pairs are unique and\nhashable, then the items view is also set-like. (Values views are not\ntreated as set-like since the entries are generally not unique.) Then\nthese set operations are available ("other" refers either to another\nview or a set):\n\ndictview & other\n\nReturn the intersection of the dictview and the other object as a\nnew set.\n\ndictview | other\n\nReturn the union of the dictview and the other object as a new set.\n\ndictview - other\n\nReturn the difference between the dictview and the other object\n(all elements in *dictview* that aren\'t in *other*) as a new set.\n\ndictview ^ other\n\nReturn the symmetric difference (all elements either in *dictview*\nor *other*, but not in both) of the dictview and the other object\nas a new set.\n\nAn example of dictionary view usage:\n\n>>> dishes = {\'eggs\': 2,\'sausage\': 1,\'bacon\': 1,\'spam\': 500}\n>>> keys = dishes.viewkeys()\n>>> values = dishes.viewvalues()\n\n>>> # iteration\n>>> n = 0\n>>> for val in values:\n... n += val\n>>> print(n)\n504\n\n>>> # keys and values are iterated over in the same order\n>>> list(keys)\n[\'eggs\',\'bacon\',\'sausage\',\'spam\']\n>>> list(values)\n[2, 1, 1, 500]\n\n>>> # view objects are dynamic and reflect dict changes\n>>> del dishes[\'eggs\']\n>>> del dishes[\'sausage\']\n>>> list(keys)\n[\'spam\',\'bacon\']\n\n>>> # set operations\n>>> keys & {\'eggs\',\'bacon\',\'salad\'}\n{\'bacon\'}\n',
73'typesmethods': u'\nMethods\n*******\n\nMethods are functions that are called using the attribute notation.\nThere are two flavors: built-in methods (such as "append()" on lists)\nand class instance methods. Built-in methods are described with the\ntypes that support them.\n\nThe implementation adds two special read-only attributes to class\ninstance methods: "m.im_self" is the object on which the method\noperates, and "m.im_func" is the function implementing the method.\nCalling "m(arg-1, arg-2, ..., arg-n)" is completely equivalent to\ncalling "m.im_func(m.im_self, arg-1, arg-2, ..., arg-n)".\n\nClass instance methods are either *bound* or *unbound*, referring to\nwhether the method was accessed through an instance or a class,\nrespectively. When a method is unbound, its "im_self" attribute will\nbe "None" and if called, an explicit "self" object must be passed as\nthe first argument. In this case, "self" must be an instance of the\nunbound method\'s class (or a subclass of that class), otherwise a\n"TypeError" is raised.\n\nLike function objects, methods objects support getting arbitrary\nattributes. However, since method attributes are actually stored on\nthe underlying function object ("meth.im_func"), setting method\nattributes on either bound or unbound methods is disallowed.\nAttempting to set an attribute on a method results in an\n"AttributeError" being raised. In order to set a method attribute,\nyou need to explicitly set it on the underlying function object:\n\n>>> class C:\n... def method(self):\n... pass\n...\n>>> c = C()\n>>> c.method.whoami =\'my name is method\'# can\'t set on the method\nTraceback (most recent call last):\nFile "<stdin>", line 1, in <module>\nAttributeError:\'instancemethod\'object has no attribute\'whoami\'\n>>> c.method.im_func.whoami =\'my name is method\'\n>>> c.method.whoami\n \'my name is method\'\n\nSee The standard type hierarchy for more information.\n',
74'typesmodules': u'\nModules\n*******\n\nThe only special operation on a module is attribute access: "m.name",\nwhere *m* is a module and *name* accesses a name defined in *m*\'s\nsymbol table. Module attributes can be assigned to. (Note that the\n"import" statement is not, strictly speaking, an operation on a module\nobject; "import foo" does not require a module object named *foo* to\nexist, rather it requires an (external) *definition* for a module\nnamed *foo* somewhere.)\n\nA special attribute of every module is "__dict__". This is the\ndictionary containing the module\'s symbol table. Modifying this\ndictionary will actually change the module\'s symbol table, but direct\nassignment to the "__dict__" attribute is not possible (you can write\n"m.__dict__[\'a\'] = 1", which defines "m.a" to be "1", but you can\'t\nwrite "m.__dict__ = {}"). Modifying "__dict__" directly is not\nrecommended.\n\nModules built into the interpreter are written like this: "<module\n\'sys\'(built-in)>". If loaded from a file, they are written as\n"<module\'os\'from\'/usr/local/lib/pythonX.Y/os.pyc\'>".\n',
75'typesseq': u'\nSequence Types --- "str", "unicode", "list", "tuple", "bytearray", "buffer", "xrange"\n*************************************************************************************\n\nThere are seven sequence types: strings, Unicode strings, lists,\ntuples, bytearrays, buffers, and xrange objects.\n\nFor other containers see the built in "dict" and "set" classes, and\nthe "collections" module.\n\nString literals are written in single or double quotes: "\'xyzzy\'",\n""frobozz"". See String literals for more about string literals.\nUnicode strings are much like strings, but are specified in the syntax\nusing a preceding "\'u\'" character: "u\'abc\'", "u"def"". In addition to\nthe functionality described here, there are also string-specific\nmethods described in the String Methods section. Lists are constructed\nwith square brackets, separating items with commas: "[a, b, c]".\nTuples are constructed by the comma operator (not within square\nbrackets), with or without enclosing parentheses, but an empty tuple\nmust have the enclosing parentheses, such as "a, b, c" or "()". A\nsingle item tuple must have a trailing comma, such as "(d,)".\n\nBytearray objects are created with the built-in function\n"bytearray()".\n\nBuffer objects are not directly supported by Python syntax, but can be\ncreated by calling the built-in function "buffer()". They don\'t\nsupport concatenation or repetition.\n\nObjects of type xrange are similar to buffers in that there is no\nspecific syntax to create them, but they are created using the\n"xrange()" function. They don\'t support slicing, concatenation or\nrepetition, and using "in", "not in", "min()" or "max()" on them is\ninefficient.\n\nMost sequence types support the following operations. The "in" and\n"not in" operations have the same priorities as the comparison\noperations. The "+" and "*" operations have the same priority as the\ncorresponding numeric operations. [3] Additional methods are provided\nfor Mutable Sequence Types.\n\nThis table lists the sequence operations sorted in ascending priority.\nIn the table, *s* and *t* are sequences of the same type; *n*, *i* and\n*j* are integers:\n\n+--------------------+----------------------------------+------------+\n| Operation | Result | Notes |\n+====================+==================================+============+\n| "x in s" | "True" if an item of *s* is | (1) |\n| | equal to *x*, else "False" | |\n+--------------------+----------------------------------+------------+\n| "x not in s" | "False" if an item of *s* is | (1) |\n| | equal to *x*, else "True" | |\n+--------------------+----------------------------------+------------+\n| "s + t" | the concatenation of *s* and *t* | (6) |\n+--------------------+----------------------------------+------------+\n| "s * n, n * s" | *n* shallow copies of *s* | (2) |\n| | concatenated | |\n+--------------------+----------------------------------+------------+\n| "s[i]" | *i*th item of *s*, origin 0 | (3) |\n+--------------------+----------------------------------+------------+\n| "s[i:j]" | slice of *s* from *i* to *j* | (3)(4) |\n+--------------------+----------------------------------+------------+\n| "s[i:j:k]" | slice of *s* from *i* to *j* | (3)(5) |\n| | with step *k* | |\n+--------------------+----------------------------------+------------+\n| "len(s)" | length of *s* | |\n+--------------------+----------------------------------+------------+\n| "min(s)" | smallest item of *s* | |\n+--------------------+----------------------------------+------------+\n| "max(s)" | largest item of *s* | |\n+--------------------+----------------------------------+------------+\n| "s.index(x)" | index of the first occurrence of | |\n| | *x* in *s* | |\n+--------------------+----------------------------------+------------+\n| "s.count(x)" | total number of occurrences of | |\n| | *x* in *s* | |\n+--------------------+----------------------------------+------------+\n\nSequence types also support comparisons. In particular, tuples and\nlists are compared lexicographically by comparing corresponding\nelements. This means that to compare equal, every element must compare\nequal and the two sequences must be of the same type and have the same\nlength. (For full details see Comparisons in the language reference.)\n\nNotes:\n\n1. When *s* is a string or Unicode string object the "in" and "not\nin" operations act like a substring test. In Python versions\nbefore 2.3, *x* had to be a string of length 1. In Python 2.3 and\nbeyond, *x* may be a string of any length.\n\n2. Values of *n* less than "0" are treated as "0" (which yields an\nempty sequence of the same type as *s*). Note also that the copies\nare shallow; nested structures are not copied. This often haunts\nnew Python programmers; consider:\n\n>>> lists = [[]] * 3\n>>> lists\n[[], [], []]\n>>> lists[0].append(3)\n>>> lists\n[[3], [3], [3]]\n\nWhat has happened is that "[[]]" is a one-element list containing\nan empty list, so all three elements of "[[]] * 3" are (pointers\nto) this single empty list. Modifying any of the elements of\n"lists" modifies this single list. You can create a list of\ndifferent lists this way:\n\n>>> lists = [[] for i in range(3)]\n>>> lists[0].append(3)\n>>> lists[1].append(5)\n>>> lists[2].append(7)\n>>> lists\n[[3], [5], [7]]\n\n3. If *i* or *j* is negative, the index is relative to the end of\nthe string: "len(s) + i" or "len(s) + j" is substituted. But note\nthat "-0" is still "0".\n\n4. The slice of *s* from *i* to *j* is defined as the sequence of\nitems with index *k* such that "i <= k < j". If *i* or *j* is\ngreater than "len(s)", use "len(s)". If *i* is omitted or "None",\nuse "0". If *j* is omitted or "None", use "len(s)". If *i* is\ngreater than or equal to *j*, the slice is empty.\n\n5. The slice of *s* from *i* to *j* with step *k* is defined as the\nsequence of items with index "x = i + n*k" such that "0 <= n <\n(j-i)/k". In other words, the indices are "i", "i+k", "i+2*k",\n"i+3*k" and so on, stopping when *j* is reached (but never\nincluding *j*). If *i* or *j* is greater than "len(s)", use\n"len(s)". If *i* or *j* are omitted or "None", they become "end"\nvalues (which end depends on the sign of *k*). Note, *k* cannot be\nzero. If *k* is "None", it is treated like "1".\n\n6. **CPython implementation detail:** If *s* and *t* are both\nstrings, some Python implementations such as CPython can usually\nperform an in-place optimization for assignments of the form "s = s\n+ t" or "s += t". When applicable, this optimization makes\nquadratic run-time much less likely. This optimization is both\nversion and implementation dependent. For performance sensitive\ncode, it is preferable to use the "str.join()" method which assures\nconsistent linear concatenation performance across versions and\nimplementations.\n\nChanged in version 2.4: Formerly, string concatenation never\noccurred in-place.\n\n\nString Methods\n==============\n\nBelow are listed the string methods which both 8-bit strings and\nUnicode objects support. Some of them are also available on\n"bytearray" objects.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the Sequence Types --- str, unicode, list, tuple,\nbytearray, buffer, xrange section. To output formatted strings use\ntemplate strings or the "%" operator described in the String\nFormatting Operations section. Also, see the "re" module for string\nfunctions based on regular expressions.\n\nstr.capitalize()\n\nReturn a copy of the string with its first character capitalized\nand the rest lowercased.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.center(width[, fillchar])\n\nReturn centered in a string of length *width*. Padding is done\nusing the specified *fillchar* (default is a space).\n\nChanged in version 2.4: Support for the *fillchar* argument.\n\nstr.count(sub[, start[, end]])\n\nReturn the number of non-overlapping occurrences of substring *sub*\nin the range [*start*, *end*]. Optional arguments *start* and\n*end* are interpreted as in slice notation.\n\nstr.decode([encoding[, errors]])\n\nDecodes the string using the codec registered for *encoding*.\n*encoding* defaults to the default string encoding. *errors* may\nbe given to set a different error handling scheme. The default is\n"\'strict\'", meaning that encoding errors raise "UnicodeError".\nOther possible values are "\'ignore\'", "\'replace\'" and any other\nname registered via "codecs.register_error()", see section Codec\nBase Classes.\n\nNew in version 2.2.\n\nChanged in version 2.3: Support for other error handling schemes\nadded.\n\nChanged in version 2.7: Support for keyword arguments added.\n\nstr.encode([encoding[, errors]])\n\nReturn an encoded version of the string. Default encoding is the\ncurrent default string encoding. *errors* may be given to set a\ndifferent error handling scheme. The default for *errors* is\n"\'strict\'", meaning that encoding errors raise a "UnicodeError".\nOther possible values are "\'ignore\'", "\'replace\'",\n"\'xmlcharrefreplace\'", "\'backslashreplace\'" and any other name\nregistered via "codecs.register_error()", see section Codec Base\nClasses. For a list of possible encodings, see section Standard\nEncodings.\n\nNew in version 2.0.\n\nChanged in version 2.3: Support for "\'xmlcharrefreplace\'" and\n"\'backslashreplace\'" and other error handling schemes added.\n\nChanged in version 2.7: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\nReturn "True" if the string ends with the specified *suffix*,\notherwise return "False". *suffix* can also be a tuple of suffixes\nto look for. With optional *start*, test beginning at that\nposition. With optional *end*, stop comparing at that position.\n\nChanged in version 2.5: Accept tuples as *suffix*.\n\nstr.expandtabs([tabsize])\n\nReturn a copy of the string where all tab characters are replaced\nby one or more spaces, depending on the current column and the\ngiven tab size. Tab positions occur every *tabsize* characters\n(default is 8, giving tab positions at columns 0, 8, 16 and so on).\nTo expand the string, the current column is set to zero and the\nstring is examined character by character. If the character is a\ntab ("\\t"), one or more space characters are inserted in the result\nuntil the current column is equal to the next tab position. (The\ntab character itself is not copied.) If the character is a newline\n("\\n") or return ("\\r"), it is copied and the current column is\nreset to zero. Any other character is copied unchanged and the\ncurrent column is incremented by one regardless of how the\ncharacter is represented when printed.\n\n>>>\'01\\t012\\t0123\\t01234\'.expandtabs()\n \'01 012 0123 01234\'\n>>>\'01\\t012\\t0123\\t01234\'.expandtabs(4)\n \'01 012 0123 01234\'\n\nstr.find(sub[, start[, end]])\n\nReturn the lowest index in the string where substring *sub* is\nfound, such that *sub* is contained in the slice "s[start:end]".\nOptional arguments *start* and *end* are interpreted as in slice\nnotation. Return "-1" if *sub* is not found.\n\nNote: The "find()" method should be used only if you need to know\nthe position of *sub*. To check if *sub* is a substring or not,\nuse the "in" operator:\n\n>>>\'Py\'in\'Python\'\nTrue\n\nstr.format(*args, **kwargs)\n\nPerform a string formatting operation. The string on which this\nmethod is called can contain literal text or replacement fields\ndelimited by braces "{}". Each replacement field contains either\nthe numeric index of a positional argument, or the name of a\nkeyword argument. Returns a copy of the string where each\nreplacement field is replaced with the string value of the\ncorresponding argument.\n\n>>> "The sum of 1 + 2 is{0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\nSee Format String Syntax for a description of the various\nformatting options that can be specified in format strings.\n\nThis method of string formatting is the new standard in Python 3,\nand should be preferred to the "%" formatting described in String\nFormatting Operations in new code.\n\nNew in version 2.6.\n\nstr.index(sub[, start[, end]])\n\nLike "find()", but raise "ValueError" when the substring is not\nfound.\n\nstr.isalnum()\n\nReturn true if all characters in the string are alphanumeric and\nthere is at least one character, false otherwise.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.isalpha()\n\nReturn true if all characters in the string are alphabetic and\nthere is at least one character, false otherwise.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.isdigit()\n\nReturn true if all characters in the string are digits and there is\nat least one character, false otherwise.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.islower()\n\nReturn true if all cased characters [4] in the string are lowercase\nand there is at least one cased character, false otherwise.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.isspace()\n\nReturn true if there are only whitespace characters in the string\nand there is at least one character, false otherwise.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.istitle()\n\nReturn true if the string is a titlecased string and there is at\nleast one character, for example uppercase characters may only\nfollow uncased characters and lowercase characters only cased ones.\nReturn false otherwise.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.isupper()\n\nReturn true if all cased characters [4] in the string are uppercase\nand there is at least one cased character, false otherwise.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.join(iterable)\n\nReturn a string which is the concatenation of the strings in the\n*iterable* *iterable*. The separator between elements is the\nstring providing this method.\n\nstr.ljust(width[, fillchar])\n\nReturn the string left justified in a string of length *width*.\nPadding is done using the specified *fillchar* (default is a\nspace). The original string is returned if *width* is less than or\nequal to "len(s)".\n\nChanged in version 2.4: Support for the *fillchar* argument.\n\nstr.lower()\n\nReturn a copy of the string with all the cased characters [4]\nconverted to lowercase.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.lstrip([chars])\n\nReturn a copy of the string with leading characters removed. The\n*chars* argument is a string specifying the set of characters to be\nremoved. If omitted or "None", the *chars* argument defaults to\nremoving whitespace. The *chars* argument is not a prefix; rather,\nall combinations of its values are stripped:\n\n>>>\'spacious\'.lstrip()\n \'spacious\'\n>>>\'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\nChanged in version 2.2.2: Support for the *chars* argument.\n\nstr.partition(sep)\n\nSplit the string at the first occurrence of *sep*, and return a\n3-tuple containing the part before the separator, the separator\nitself, and the part after the separator. If the separator is not\nfound, return a 3-tuple containing the string itself, followed by\ntwo empty strings.\n\nNew in version 2.5.\n\nstr.replace(old, new[, count])\n\nReturn a copy of the string with all occurrences of substring *old*\nreplaced by *new*. If the optional argument *count* is given, only\nthe first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\nReturn the highest index in the string where substring *sub* is\nfound, such that *sub* is contained within "s[start:end]".\nOptional arguments *start* and *end* are interpreted as in slice\nnotation. Return "-1" on failure.\n\nstr.rindex(sub[, start[, end]])\n\nLike "rfind()" but raises "ValueError" when the substring *sub* is\nnot found.\n\nstr.rjust(width[, fillchar])\n\nReturn the string right justified in a string of length *width*.\nPadding is done using the specified *fillchar* (default is a\nspace). The original string is returned if *width* is less than or\nequal to "len(s)".\n\nChanged in version 2.4: Support for the *fillchar* argument.\n\nstr.rpartition(sep)\n\nSplit the string at the last occurrence of *sep*, and return a\n3-tuple containing the part before the separator, the separator\nitself, and the part after the separator. If the separator is not\nfound, return a 3-tuple containing two empty strings, followed by\nthe string itself.\n\nNew in version 2.5.\n\nstr.rsplit([sep[, maxsplit]])\n\nReturn a list of the words in the string, using *sep* as the\ndelimiter string. If *maxsplit* is given, at most *maxsplit* splits\nare done, the *rightmost* ones. If *sep* is not specified or\n"None", any whitespace string is a separator. Except for splitting\nfrom the right, "rsplit()" behaves like "split()" which is\ndescribed in detail below.\n\nNew in version 2.4.\n\nstr.rstrip([chars])\n\nReturn a copy of the string with trailing characters removed. The\n*chars* argument is a string specifying the set of characters to be\nremoved. If omitted or "None", the *chars* argument defaults to\nremoving whitespace. The *chars* argument is not a suffix; rather,\nall combinations of its values are stripped:\n\n>>>\'spacious\'.rstrip()\n \'spacious\'\n>>>\'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\nChanged in version 2.2.2: Support for the *chars* argument.\n\nstr.split([sep[, maxsplit]])\n\nReturn a list of the words in the string, using *sep* as the\ndelimiter string. If *maxsplit* is given, at most *maxsplit*\nsplits are done (thus, the list will have at most "maxsplit+1"\nelements). If *maxsplit* is not specified or "-1", then there is\nno limit on the number of splits (all possible splits are made).\n\nIf *sep* is given, consecutive delimiters are not grouped together\nand are deemed to delimit empty strings (for example,\n"\'1,,2\'.split(\',\')" returns "[\'1\',\'\',\'2\']"). The *sep* argument\nmay consist of multiple characters (for example,\n"\'1<>2<>3\'.split(\'<>\')" returns "[\'1\',\'2\',\'3\']"). Splitting an\nempty string with a specified separator returns "[\'\']".\n\nIf *sep* is not specified or is "None", a different splitting\nalgorithm is applied: runs of consecutive whitespace are regarded\nas a single separator, and the result will contain no empty strings\nat the start or end if the string has leading or trailing\nwhitespace. Consequently, splitting an empty string or a string\nconsisting of just whitespace with a "None" separator returns "[]".\n\nFor example, "\'1 2 3\'.split()" returns "[\'1\',\'2\',\'3\']", and\n"\'1 2 3\'.split(None, 1)" returns "[\'1\',\'2 3\']".\n\nstr.splitlines([keepends])\n\nReturn a list of the lines in the string, breaking at line\nboundaries. This method uses the *universal newlines* approach to\nsplitting lines. Line breaks are not included in the resulting list\nunless *keepends* is given and true.\n\nFor example, "\'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()" returns "[\'ab\nc\',\'\',\'de fg\',\'kl\']", while the same call with\n"splitlines(True)" returns "[\'ab c\\n\',\'\\n\',\'de fg\\r\',\'kl\\r\\n\']".\n\nUnlike "split()" when a delimiter string *sep* is given, this\nmethod returns an empty list for the empty string, and a terminal\nline break does not result in an extra line.\n\nstr.startswith(prefix[, start[, end]])\n\nReturn "True" if string starts with the *prefix*, otherwise return\n"False". *prefix* can also be a tuple of prefixes to look for.\nWith optional *start*, test string beginning at that position.\nWith optional *end*, stop comparing string at that position.\n\nChanged in version 2.5: Accept tuples as *prefix*.\n\nstr.strip([chars])\n\nReturn a copy of the string with the leading and trailing\ncharacters removed. The *chars* argument is a string specifying the\nset of characters to be removed. If omitted or "None", the *chars*\nargument defaults to removing whitespace. The *chars* argument is\nnot a prefix or suffix; rather, all combinations of its values are\nstripped:\n\n>>>\'spacious\'.strip()\n \'spacious\'\n>>>\'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\nChanged in version 2.2.2: Support for the *chars* argument.\n\nstr.swapcase()\n\nReturn a copy of the string with uppercase characters converted to\nlowercase and vice versa.\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.title()\n\nReturn a titlecased version of the string where words start with an\nuppercase character and the remaining characters are lowercase.\n\nThe algorithm uses a simple language-independent definition of a\nword as groups of consecutive letters. The definition works in\nmany contexts but it means that apostrophes in contractions and\npossessives form word boundaries, which may not be the desired\nresult:\n\n>>> "they\'re bill\'s friends from the UK".title()\n"They\'Re Bill\'S Friends From The Uk"\n\nA workaround for apostrophes can be constructed using regular\nexpressions:\n\n>>> import re\n>>> def titlecase(s):\n... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n... lambda mo: mo.group(0)[0].upper() +\n... mo.group(0)[1:].lower(),\n... s)\n...\n>>> titlecase("they\'re bill\'s friends.")\n"They\'re Bill\'s Friends."\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.translate(table[, deletechars])\n\nReturn a copy of the string where all characters occurring in the\noptional argument *deletechars* are removed, and the remaining\ncharacters have been mapped through the given translation table,\nwhich must be a string of length 256.\n\nYou can use the "maketrans()" helper function in the "string"\nmodule to create a translation table. For string objects, set the\n*table* argument to "None" for translations that only delete\ncharacters:\n\n>>>\'read this short text\'.translate(None,\'aeiou\')\n \'rd ths shrt txt\'\n\nNew in version 2.6: Support for a "None" *table* argument.\n\nFor Unicode objects, the "translate()" method does not accept the\noptional *deletechars* argument. Instead, it returns a copy of the\n*s* where all characters have been mapped through the given\ntranslation table which must be a mapping of Unicode ordinals to\nUnicode ordinals, Unicode strings or "None". Unmapped characters\nare left untouched. Characters mapped to "None" are deleted. Note,\na more flexible approach is to create a custom character mapping\ncodec using the "codecs" module (see "encodings.cp1251" for an\nexample).\n\nstr.upper()\n\nReturn a copy of the string with all the cased characters [4]\nconverted to uppercase. Note that "str.upper().isupper()" might be\n"False" if "s" contains uncased characters or if the Unicode\ncategory of the resulting character(s) is not "Lu" (Letter,\nuppercase), but e.g. "Lt" (Letter, titlecase).\n\nFor 8-bit strings, this method is locale-dependent.\n\nstr.zfill(width)\n\nReturn the numeric string left filled with zeros in a string of\nlength *width*. A sign prefix is handled correctly. The original\nstring is returned if *width* is less than or equal to "len(s)".\n\nNew in version 2.2.2.\n\nThe following methods are present only on unicode objects:\n\nunicode.isnumeric()\n\nReturn "True" if there are only numeric characters in S, "False"\notherwise. Numeric characters include digit characters, and all\ncharacters that have the Unicode numeric value property, e.g.\nU+2155, VULGAR FRACTION ONE FIFTH.\n\nunicode.isdecimal()\n\nReturn "True" if there are only decimal characters in S, "False"\notherwise. Decimal characters include digit characters, and all\ncharacters that can be used to form decimal-radix numbers, e.g.\nU+0660, ARABIC-INDIC DIGIT ZERO.\n\n\nString Formatting Operations\n============================\n\nString and Unicode objects have one unique built-in operation: the "%"\noperator (modulo). This is also known as the string *formatting* or\n*interpolation* operator. Given "format % values" (where *format* is\na string or Unicode object), "%" conversion specifications in *format*\nare replaced with zero or more elements of *values*. The effect is\nsimilar to the using "sprintf()" in the C language. If *format* is a\nUnicode object, or if any of the objects being converted using the\n"%s" conversion are Unicode objects, the result will also be a Unicode\nobject.\n\nIf *format* requires a single argument, *values* may be a single non-\ntuple object. [5] Otherwise, *values* must be a tuple with exactly\nthe number of items specified by the format string, or a single\nmapping object (for example, a dictionary).\n\nA conversion specifier contains two or more characters and has the\nfollowing components, which must occur in this order:\n\n1. The "\'%\'" character, which marks the start of the specifier.\n\n2. Mapping key (optional), consisting of a parenthesised sequence\nof characters (for example, "(somename)").\n\n3. Conversion flags (optional), which affect the result of some\nconversion types.\n\n4. Minimum field width (optional). If specified as an "\'*\'"\n(asterisk), the actual width is read from the next element of the\ntuple in *values*, and the object to convert comes after the\nminimum field width and optional precision.\n\n5. Precision (optional), given as a "\'.\'" (dot) followed by the\nprecision. If specified as "\'*\'" (an asterisk), the actual width\nis read from the next element of the tuple in *values*, and the\nvalue to convert comes after the precision.\n\n6. Length modifier (optional).\n\n7. Conversion type.\n\nWhen the right argument is a dictionary (or other mapping type), then\nthe formats in the string *must* include a parenthesised mapping key\ninto that dictionary inserted immediately after the "\'%\'" character.\nThe mapping key selects the value to be formatted from the mapping.\nFor example:\n\n>>> print\'%(language)shas%(number)03d quote types.\'%\\\n... {"language": "Python", "number": 2}\nPython has 002 quote types.\n\nIn this case no "*" specifiers may occur in a format (since they\nrequire a sequential parameter list).\n\nThe conversion flag characters are:\n\n+-----------+-----------------------------------------------------------------------+\n| Flag | Meaning |\n+===========+=======================================================================+\n| "\'#\'" | The value conversion will use the "alternate form" (where defined |\n| | below). |\n+-----------+-----------------------------------------------------------------------+\n| "\'0\'" | The conversion will be zero padded for numeric values. |\n+-----------+-----------------------------------------------------------------------+\n| "\'-\'" | The converted value is left adjusted (overrides the "\'0\'" conversion |\n| | if both are given). |\n+-----------+-----------------------------------------------------------------------+\n| "\' \'" | (a space) A blank should be left before a positive number (or empty |\n| | string) produced by a signed conversion. |\n+-----------+-----------------------------------------------------------------------+\n| "\'+\'" | A sign character ("\'+\'" or "\'-\'") will precede the conversion |\n| | (overrides a "space" flag). |\n+-----------+-----------------------------------------------------------------------+\n\nA length modifier ("h", "l", or "L") may be present, but is ignored as\nit is not necessary for Python -- so e.g. "%ld" is identical to "%d".\n\nThe conversion types are:\n\n+--------------+-------------------------------------------------------+---------+\n| Conversion | Meaning | Notes |\n+==============+=======================================================+=========+\n| "\'d\'" | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| "\'i\'" | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| "\'o\'" | Signed octal value. | (1) |\n+--------------+-------------------------------------------------------+---------+\n| "\'u\'" | Obsolete type -- it is identical to "\'d\'". | (7) |\n+--------------+-------------------------------------------------------+---------+\n| "\'x\'" | Signed hexadecimal (lowercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| "\'X\'" | Signed hexadecimal (uppercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| "\'e\'" | Floating point exponential format (lowercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| "\'E\'" | Floating point exponential format (uppercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| "\'f\'" | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| "\'F\'" | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| "\'g\'" | Floating point format. Uses lowercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| "\'G\'" | Floating point format. Uses uppercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| "\'c\'" | Single character (accepts integer or single character | |\n| | string). | |\n+--------------+-------------------------------------------------------+---------+\n| "\'r\'" | String (converts any Python object using repr()). | (5) |\n+--------------+-------------------------------------------------------+---------+\n| "\'s\'" | String (converts any Python object using "str()"). | (6) |\n+--------------+-------------------------------------------------------+---------+\n| "\'%\'" | No argument is converted, results in a "\'%\'" | |\n| | character in the result. | |\n+--------------+-------------------------------------------------------+---------+\n\nNotes:\n\n1. The alternate form causes a leading zero ("\'0\'") to be inserted\nbetween left-hand padding and the formatting of the number if the\nleading character of the result is not already a zero.\n\n2. The alternate form causes a leading "\'0x\'" or "\'0X\'" (depending\non whether the "\'x\'" or "\'X\'" format was used) to be inserted\nbetween left-hand padding and the formatting of the number if the\nleading character of the result is not already a zero.\n\n3. The alternate form causes the result to always contain a decimal\npoint, even if no digits follow it.\n\nThe precision determines the number of digits after the decimal\npoint and defaults to 6.\n\n4. The alternate form causes the result to always contain a decimal\npoint, and trailing zeroes are not removed as they would otherwise\nbe.\n\nThe precision determines the number of significant digits before\nand after the decimal point and defaults to 6.\n\n5. The "%r" conversion was added in Python 2.0.\n\nThe precision determines the maximal number of characters used.\n\n6. If the object or format provided is a "unicode" string, the\nresulting string will also be "unicode".\n\nThe precision determines the maximal number of characters used.\n\n7. See **PEP 237**.\n\nSince Python strings have an explicit length, "%s" conversions do not\nassume that "\'\\0\'" is the end of the string.\n\nChanged in version 2.7: "%f" conversions for numbers whose absolute\nvalue is over 1e50 are no longer replaced by "%g" conversions.\n\nAdditional string operations are defined in standard modules "string"\nand "re".\n\n\nXRange Type\n===========\n\nThe "xrange" type is an immutable sequence which is commonly used for\nlooping. The advantage of the "xrange" type is that an "xrange"\nobject will always take the same amount of memory, no matter the size\nof the range it represents. There are no consistent performance\nadvantages.\n\nXRange objects have very little behavior: they only support indexing,\niteration, and the "len()" function.\n\n\nMutable Sequence Types\n======================\n\nList and "bytearray" objects support additional operations that allow\nin-place modification of the object. Other mutable sequence types\n(when added to the language) should also support these operations.\nStrings and tuples are immutable sequence types: such objects cannot\nbe modified once created. The following operations are defined on\nmutable sequence types (where *x* is an arbitrary object):\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| "s[i] = x" | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t" | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]" | same as "s[i:j] = []" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]" | removes the elements of | |\n| | "s[i:j:k]" from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)" | same as "s[len(s):len(s)] = [x]" | (2) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(x)" | same as "s[len(s):len(s)] = x" | (3) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.count(x)" | return number of *i*\'s for which | |\n| | "s[i] == x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.index(x[, i[, j]])" | return smallest *k* such that | (4) |\n| | "s[k] == x" and "i <= k < j" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)" | same as "s[i:i] = [x]" | (5) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])" | same as "x = s[i]; del s[i]; | (6) |\n| | return x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)" | same as "del s[s.index(x)]" | (4) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()" | reverses the items of *s* in | (7) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.sort([cmp[, key[, | sort the items of *s* in place | (7)(8)(9)(10) |\n| reverse]]])" | | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The C implementation of Python has historically accepted\nmultiple parameters and implicitly joined them into a tuple; this\nno longer works in Python 2.0. Use of this misfeature has been\ndeprecated since Python 1.4.\n\n3. *x* can be any iterable object.\n\n4. Raises "ValueError" when *x* is not found in *s*. When a\nnegative index is passed as the second or third parameter to the\n"index()" method, the list length is added, as for slice indices.\nIf it is still negative, it is truncated to zero, as for slice\nindices.\n\nChanged in version 2.3: Previously, "index()" didn\'t have arguments\nfor specifying start and stop positions.\n\n5. When a negative index is passed as the first parameter to the\n"insert()" method, the list length is added, as for slice indices.\nIf it is still negative, it is truncated to zero, as for slice\nindices.\n\nChanged in version 2.3: Previously, all negative indices were\ntruncated to zero.\n\n6. The "pop()" method\'s optional argument *i* defaults to "-1", so\nthat by default the last item is removed and returned.\n\n7. The "sort()" and "reverse()" methods modify the list in place\nfor economy of space when sorting or reversing a large list. To\nremind you that they operate by side effect, they don\'t return the\nsorted or reversed list.\n\n8. The "sort()" method takes optional arguments for controlling the\ncomparisons.\n\n*cmp* specifies a custom comparison function of two arguments (list\nitems) which should return a negative, zero or positive number\ndepending on whether the first argument is considered smaller than,\nequal to, or larger than the second argument: "cmp=lambda x,y:\ncmp(x.lower(), y.lower())". The default value is "None".\n\n*key* specifies a function of one argument that is used to extract\na comparison key from each list element: "key=str.lower". The\ndefault value is "None".\n\n*reverse* is a boolean value. If set to "True", then the list\nelements are sorted as if each comparison were reversed.\n\nIn general, the *key* and *reverse* conversion processes are much\nfaster than specifying an equivalent *cmp* function. This is\nbecause *cmp* is called multiple times for each list element while\n*key* and *reverse* touch each element only once. Use\n"functools.cmp_to_key()" to convert an old-style *cmp* function to\na *key* function.\n\nChanged in version 2.3: Support for "None" as an equivalent to\nomitting *cmp* was added.\n\nChanged in version 2.4: Support for *key* and *reverse* was added.\n\n9. Starting with Python 2.3, the "sort()" method is guaranteed to\nbe stable. A sort is stable if it guarantees not to change the\nrelative order of elements that compare equal --- this is helpful\nfor sorting in multiple passes (for example, sort by department,\nthen by salary grade).\n\n10. **CPython implementation detail:** While a list is being\nsorted, the effect of attempting to mutate, or even inspect, the\nlist is undefined. The C implementation of Python 2.3 and newer\nmakes the list appear empty for the duration, and raises\n"ValueError" if it can detect that the list has been mutated\nduring a sort.\n',
76'typesseq-mutable': u'\nMutable Sequence Types\n**********************\n\nList and "bytearray" objects support additional operations that allow\nin-place modification of the object. Other mutable sequence types\n(when added to the language) should also support these operations.\nStrings and tuples are immutable sequence types: such objects cannot\nbe modified once created. The following operations are defined on\nmutable sequence types (where *x* is an arbitrary object):\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| "s[i] = x" | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t" | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]" | same as "s[i:j] = []" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]" | removes the elements of | |\n| | "s[i:j:k]" from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)" | same as "s[len(s):len(s)] = [x]" | (2) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(x)" | same as "s[len(s):len(s)] = x" | (3) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.count(x)" | return number of *i*\'s for which | |\n| | "s[i] == x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.index(x[, i[, j]])" | return smallest *k* such that | (4) |\n| | "s[k] == x" and "i <= k < j" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)" | same as "s[i:i] = [x]" | (5) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])" | same as "x = s[i]; del s[i]; | (6) |\n| | return x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)" | same as "del s[s.index(x)]" | (4) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()" | reverses the items of *s* in | (7) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.sort([cmp[, key[, | sort the items of *s* in place | (7)(8)(9)(10) |\n| reverse]]])" | | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The C implementation of Python has historically accepted\nmultiple parameters and implicitly joined them into a tuple; this\nno longer works in Python 2.0. Use of this misfeature has been\ndeprecated since Python 1.4.\n\n3. *x* can be any iterable object.\n\n4. Raises "ValueError" when *x* is not found in *s*. When a\nnegative index is passed as the second or third parameter to the\n"index()" method, the list length is added, as for slice indices.\nIf it is still negative, it is truncated to zero, as for slice\nindices.\n\nChanged in version 2.3: Previously, "index()" didn\'t have arguments\nfor specifying start and stop positions.\n\n5. When a negative index is passed as the first parameter to the\n"insert()" method, the list length is added, as for slice indices.\nIf it is still negative, it is truncated to zero, as for slice\nindices.\n\nChanged in version 2.3: Previously, all negative indices were\ntruncated to zero.\n\n6. The "pop()" method\'s optional argument *i* defaults to "-1", so\nthat by default the last item is removed and returned.\n\n7. The "sort()" and "reverse()" methods modify the list in place\nfor economy of space when sorting or reversing a large list. To\nremind you that they operate by side effect, they don\'t return the\nsorted or reversed list.\n\n8. The "sort()" method takes optional arguments for controlling the\ncomparisons.\n\n*cmp* specifies a custom comparison function of two arguments (list\nitems) which should return a negative, zero or positive number\ndepending on whether the first argument is considered smaller than,\nequal to, or larger than the second argument: "cmp=lambda x,y:\ncmp(x.lower(), y.lower())". The default value is "None".\n\n*key* specifies a function of one argument that is used to extract\na comparison key from each list element: "key=str.lower". The\ndefault value is "None".\n\n*reverse* is a boolean value. If set to "True", then the list\nelements are sorted as if each comparison were reversed.\n\nIn general, the *key* and *reverse* conversion processes are much\nfaster than specifying an equivalent *cmp* function. This is\nbecause *cmp* is called multiple times for each list element while\n*key* and *reverse* touch each element only once. Use\n"functools.cmp_to_key()" to convert an old-style *cmp* function to\na *key* function.\n\nChanged in version 2.3: Support for "None" as an equivalent to\nomitting *cmp* was added.\n\nChanged in version 2.4: Support for *key* and *reverse* was added.\n\n9. Starting with Python 2.3, the "sort()" method is guaranteed to\nbe stable. A sort is stable if it guarantees not to change the\nrelative order of elements that compare equal --- this is helpful\nfor sorting in multiple passes (for example, sort by department,\nthen by salary grade).\n\n10. **CPython implementation detail:** While a list is being\nsorted, the effect of attempting to mutate, or even inspect, the\nlist is undefined. The C implementation of Python 2.3 and newer\nmakes the list appear empty for the duration, and raises\n"ValueError" if it can detect that the list has been mutated\nduring a sort.\n',
77'unary': u'\nUnary arithmetic and bitwise operations\n***************************************\n\nAll unary arithmetic and bitwise operations have the same priority:\n\nu_expr ::= power | "-" u_expr | "+" u_expr | "~" u_expr\n\nThe unary "-" (minus) operator yields the negation of its numeric\nargument.\n\nThe unary "+" (plus) operator yields its numeric argument unchanged.\n\nThe unary "~" (invert) operator yields the bitwise inversion of its\nplain or long integer argument. The bitwise inversion of "x" is\ndefined as "-(x+1)". It only applies to integral numbers.\n\nIn all three cases, if the argument does not have the proper type, a\n"TypeError" exception is raised.\n',
78'while': u'\nThe "while" statement\n*********************\n\nThe "while" statement is used for repeated execution as long as an\nexpression is true:\n\nwhile_stmt ::= "while" expression ":" suite\n["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the "else" clause, if present, is executed\nand the loop terminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and goes back\nto testing the expression.\n',
79'with': u'\nThe "with" statement\n********************\n\nNew in version 2.5.\n\nThe "with" statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section With Statement\nContext Managers). This allows common "try"..."except"..."finally"\nusage patterns to be encapsulated for convenient reuse.\n\nwith_stmt ::= "with" with_item ("," with_item)* ":" suite\nwith_item ::= expression ["as" target]\n\nThe execution of the "with" statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the "with_item")\nis evaluated to obtain a context manager.\n\n2. The context manager\'s "__exit__()" is loaded for later use.\n\n3. The context manager\'s "__enter__()" method is invoked.\n\n4. If a target was included in the "with" statement, the return\nvalue from "__enter__()" is assigned to it.\n\nNote: The "with" statement guarantees that if the "__enter__()"\nmethod returns without an error, then "__exit__()" will always be\ncalled. Thus, if an error occurs during the assignment to the\ntarget list, it will be treated the same as an error occurring\nwithin the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s "__exit__()" method is invoked. If an\nexception caused the suite to be exited, its type, value, and\ntraceback are passed as arguments to "__exit__()". Otherwise, three\n"None" arguments are supplied.\n\nIf the suite was exited due to an exception, and the return value\nfrom the "__exit__()" method was false, the exception is reraised.\nIf the return value was true, the exception is suppressed, and\nexecution continues with the statement following the "with"\nstatement.\n\nIf the suite was exited for any reason other than an exception, the\nreturn value from "__exit__()" is ignored, and execution proceeds\nat the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple "with" statements were nested:\n\nwith A() as a, B() as b:\nsuite\n\nis equivalent to\n\nwith A() as a:\nwith B() as b:\nsuite\n\nNote: In Python 2.5, the "with" statement is only allowed when the\n"with_statement" feature has been enabled. It is always enabled in\nPython 2.6.\n\nChanged in version 2.7: Support for multiple context expressions.\n\nSee also: **PEP 0343** - The "with" statement\n\nThe specification, background, and examples for the Python "with"\nstatement.\n',
80'yield': u'\nThe "yield" statement\n*********************\n\nyield_stmt ::= yield_expression\n\nThe "yield" statement is only used when defining a generator function,\nand is only used in the body of the generator function. Using a\n"yield" statement in a function definition is sufficient to cause that\ndefinition to create a generator function instead of a normal\nfunction.\n\nWhen a generator function is called, it returns an iterator known as a\ngenerator iterator, or more commonly, a generator. The body of the\ngenerator function is executed by calling the generator\'s "next()"\nmethod repeatedly until it raises an exception.\n\nWhen a "yield" statement is executed, the state of the generator is\nfrozen and the value of "expression_list" is returned to "next()"\'s\ncaller. By "frozen" we mean that all local state is retained,\nincluding the current bindings of local variables, the instruction\npointer, and the internal evaluation stack: enough information is\nsaved so that the next time "next()" is invoked, the function can\nproceed exactly as if the "yield" statement were just another external\ncall.\n\nAs of Python version 2.5, the "yield" statement is now allowed in the\n"try" clause of a "try" ... "finally" construct. If the generator is\nnot resumed before it is finalized (by reaching a zero reference count\nor by being garbage collected), the generator-iterator\'s "close()"\nmethod will be called, allowing any pending "finally" clauses to\nexecute.\n\nFor full details of "yield" semantics, refer to the Yield expressions\nsection.\n\nNote: In Python 2.2, the "yield" statement was only allowed when the\n"generators" feature has been enabled. This "__future__" import\nstatement was used to enable the feature:\n\nfrom __future__ import generators\n\nSee also: **PEP 0255** - Simple Generators\n\nThe proposal for adding generators and the "yield" statement to\nPython.\n\n**PEP 0342** - Coroutines via Enhanced Generators\nThe proposal that, among other generator enhancements, proposed\nallowing "yield" to appear inside a "try" ... "finally" block.\n'}