Searched defs:methods (Results 1 - 14 of 14) sorted by relevance

/device/linaro/bootloader/edk2/AppPkg/Applications/Python/Python-2.7.10/Include/
H A Dmethodobject.h11 not Python methods in user-defined classes. See classobject.h
61 the construction of methods for a class. These cannot be used for
74 PyMethodDef *methods; /* Methods of this type */ member in struct:PyMethodChain
/device/linaro/bootloader/edk2/AppPkg/Applications/Python/Python-2.7.2/Include/
H A Dmethodobject.h11 not Python methods in user-defined classes. See classobject.h
61 the construction of methods for a class. These cannot be used for
74 PyMethodDef *methods; /* Methods of this type */ member in struct:PyMethodChain
/device/linaro/bootloader/edk2/AppPkg/Applications/Python/Python-2.7.10/Objects/
H A Dmethodobject.c128 /* Methods (the standard built-in methods, that is) */
316 /* List all methods in a chain -- helper for findmethodinchain */
328 for (ml = c->methods; ml->ml_name != NULL; ml++)
336 for (ml = c->methods; ml->ml_name != NULL; ml++) {
368 PyMethodDef *ml = chain->methods;
384 Py_FindMethod(PyMethodDef *methods, PyObject *self, const char *name) argument
387 chain.methods = methods;
/device/linaro/bootloader/edk2/AppPkg/Applications/Python/Python-2.7.10/Python/
H A Dmodsupport.c16 - methods is the list of top-level functions
32 Py_InitModule4(const char *name, PyMethodDef *methods, const char *doc, argument
68 if (methods != NULL) {
72 for (ml = methods; ml->ml_name != NULL; ml++) {
H A Dcodecs.c787 } methods[] = local
857 for (i = 0; i < sizeof(methods)/sizeof(methods[0]); ++i) {
858 PyObject *func = PyCFunction_New(&methods[i].def, NULL);
862 res = PyCodec_RegisterError(methods[i].name, func);
H A Dceval.c3271 /* decref'ing the frame can cause __del__ methods to get invoked,
4041 /* optimize access to bound methods */
4621 build_class(PyObject *methods, PyObject *bases, PyObject *name) argument
4625 if (PyDict_Check(methods))
4626 metaclass = PyDict_GetItemString(methods, "__metaclass__");
4646 result = PyObject_CallFunctionObjArgs(metaclass, name, bases, methods,
/device/linaro/bootloader/edk2/AppPkg/Applications/Python/Python-2.7.2/Objects/
H A Dmethodobject.c128 /* Methods (the standard built-in methods, that is) */
316 /* List all methods in a chain -- helper for findmethodinchain */
328 for (ml = c->methods; ml->ml_name != NULL; ml++)
336 for (ml = c->methods; ml->ml_name != NULL; ml++) {
368 PyMethodDef *ml = chain->methods;
384 Py_FindMethod(PyMethodDef *methods, PyObject *self, const char *name) argument
387 chain.methods = methods;
/device/linaro/bootloader/edk2/AppPkg/Applications/Python/Python-2.7.2/Python/
H A Dmodsupport.c16 - methods is the list of top-level functions
32 Py_InitModule4(const char *name, PyMethodDef *methods, const char *doc, argument
68 if (methods != NULL) {
72 for (ml = methods; ml->ml_name != NULL; ml++) {
H A Dcodecs.c770 } methods[] = local
840 for (i = 0; i < sizeof(methods)/sizeof(methods[0]); ++i) {
841 PyObject *func = PyCFunction_New(&methods[i].def, NULL);
845 res = PyCodec_RegisterError(methods[i].name, func);
H A Dceval.c3257 /* decref'ing the frame can cause __del__ methods to get invoked,
4019 /* optimize access to bound methods */
4599 build_class(PyObject *methods, PyObject *bases, PyObject *name) argument
4603 if (PyDict_Check(methods))
4604 metaclass = PyDict_GetItemString(methods, "__metaclass__");
4624 result = PyObject_CallFunctionObjArgs(metaclass, name, bases, methods,
/device/linaro/bootloader/edk2/AppPkg/Applications/Python/Python-2.7.2/Lib/test/
H A Dtest_xml_etree.py153 Make sure all standard element methods exist.
173 These methods return an iterable. See bug 6472.
260 Test find methods using the elementpath fallback.
295 Test find methods (including xpath syntax).
947 def methods(): function
949 Test serialization methods.
/device/linaro/bootloader/edk2/AppPkg/Applications/Python/Python-2.7.2/Modules/
H A Dflmodule.c381 /* methods */
391 newgenericobject(FL_OBJECT *generic, PyMethodDef *methods) argument
398 g->ob_methods = methods;
1606 /* methods */
/device/linaro/bootloader/edk2/AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/
H A Dtopics.py7 '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\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for "self"). "name" is the attribute name. This\n method should return the (computed) attribute value or raise an\n "AttributeError" exception.\n\n Note that if the attribute is found through the normal mechanism,\n "__getattr__()" is not called. (This is an intentional asymmetry\n between "__getattr__()" and "__setattr__()".) This is done both for\n efficiency reasons and because otherwise "__getattr__()" would have\n no way to access other attributes of the instance. Note that at\n least for instance variables, you can fake total control by not\n inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n "__getattribute__()" method below for a way to actually get total\n control in new-style classes.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If "__setattr__()" wants to assign to an instance attribute, it\n should not simply execute "self.name = value" --- this would cause\n a recursive call to itself. Instead, it should insert the value in\n the dictionary of instance attributes, e.g., "self.__dict__[name] =\n value". For new-style classes, rather than accessing the instance\n dictionary, it should call the base class method with the same\n name, for example, "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\n Like "__setattr__()" but for attribute deletion instead of\n assignment. This should only be implemented if "del obj.name" is\n meaningful 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\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines "__getattr__()",\n the latter will not be called unless "__getattribute__()" either\n calls it explicitly or raises an "AttributeError". This method\n should return the (computed) attribute value or raise an\n "AttributeError" exception. In order to avoid infinite recursion in\n this method, its implementation should always call the base class\n method with the same name to access any attributes it needs, for\n example, "object.__getattribute__(self, name)".\n\n Note: This method may still be bypassed when looking up special\n methods as the result of implicit invocation via language syntax\n or built-in functions. See Special method lookup for new-style\n classes.\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\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or "None" when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an "AttributeError"\n exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner 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\n The simplest and least common call is when user code directly\n invokes a descriptor method: "x.__get__(a)".\n\nInstance Binding\n If binding to a new-style object instance, "a.x" is transformed\n into the call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\n If binding to a new-style class, "A.x" is transformed into the\n call: "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\n If "a" is an instance of "super", then the binding "super(B,\n obj).m()" searches "obj.__class__.__mro__" for the base class "A"\n immediately preceding "B" and then invokes the descriptor with the\n call: "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 (includin
26 'customization': u'\\nBasic customization\\n*******************\\n\\nobject.__new__(cls[, ...])\\n\\n Called to create a new instance of class *cls*. "__new__()" is a\\n static method (special-cased so you need not declare it as such)\\n that takes the class of which an instance was requested as its\\n first argument. The remaining arguments are those passed to the\\n object constructor expression (the call to the class). The return\\n value of "__new__()" should be the new object instance (usually an\\n instance of *cls*).\\n\\n Typical implementations create a new instance of the class by\\n invoking the superclass\\'s "__new__()" method using\\n "super(currentclass, cls).__new__(cls[, ...])" with appropriate\\n arguments and then modifying the newly-created instance as\\n necessary before returning it.\\n\\n If "__new__()" returns an instance of *cls*, then the new\\n instance\\'s "__init__()" method will be invoked like\\n "__init__(self[, ...])", where *self* is the new instance and the\\n remaining arguments are the same as were passed to "__new__()".\\n\\n If "__new__()" does not return an instance of *cls*, then the new\\n instance\\'s "__init__()" method will not be invoked.\\n\\n "__new__()" is intended mainly to allow subclasses of immutable\\n types (like int, str, or tuple) to customize instance creation. It\\n is also commonly overridden in custom metaclasses in order to\\n customize class creation.\\n\\nobject.__init__(self[, ...])\\n\\n Called after the instance has been created (by "__new__()"), but\\n before it is returned to the caller. The arguments are those\\n passed to the class constructor expression. If a base class has an\\n "__init__()" method, the derived class\\'s "__init__()" method, if\\n any, must explicitly call it to ensure proper initialization of the\\n base class part of the instance; for example:\\n "BaseClass.__init__(self, [args...])".\\n\\n Because "__new__()" and "__init__()" work together in constructing\\n objects ("__new__()" to create it, and "__init__()" to customise\\n it), no non-"None" value may be returned by "__init__()"; doing so\\n will cause a "TypeError" to be raised at runtime.\\n\\nobject.__del__(self)\\n\\n Called when the instance is about to be destroyed. This is also\\n called a destructor. If a base class has a "__del__()" method, the\\n derived class\\'s "__del__()" method, if any, must explicitly call it\\n to ensure proper deletion of the base class part of the instance.\\n Note that it is possible (though not recommended!) for the\\n "__del__()" method to postpone destruction of the instance by\\n creating a new reference to it. It may then be called at a later\\n time when this new reference is deleted. It is not guaranteed that\\n "__del__()" methods are called for objects that still exist when\\n the interpreter exits.\\n\\n Note: "del x" doesn\\'t directly call "x.__del__()" --- the former\\n decrements the reference count for "x" by one, and the latter is\\n only called when "x"\\'s reference count reaches zero. Some common\\n situations that may prevent the reference count of an object from\\n going to zero include: circular references between objects (e.g.,\\n a doubly-linked list or a tree data structure with parent and\\n child pointers); a reference to the object on the stack frame of\\n a function that caught an exception (the traceback stored in\\n "sys.exc_traceback" keeps the stack frame alive); or a reference\\n to the object on the stack frame that raised an unhandled\\n exception in interactive mode (the traceback stored in\\n "sys.last_traceback" keeps the stack frame alive). The first\\n situation can only be remedied by explicitly breaking the cycles;\\n the latter two situations can be resolved by storing "None" in\\n "sys.exc_traceback" or "sys.last_traceback". Circular references\\n which are garbage are detected when the option cycle detector is\\n enabled (it\\'s on by default), but can only be cleaned up if there\\n are no Python-level "__del__()" methods involved. Refer to the\\n documentation for the "gc" module for more information about how\\n "__del__()" methods are handled by the cycle detector,\\n particularly the description of the "garbage" value.\\n\\n Warning: Due to the precarious circumstances under which\\n "__del__()" methods are invoked, exceptions that occur during\\n their execution are ignored, and a warning is printed to\\n "sys.stderr" instead. Also, when "__del__()" is invoked in\\n response to a module being deleted (e.g., when execution of the\\n program is done), other globals referenced by the "__del__()"\\n method may already have been deleted or in the process of being\\n torn down (e.g. the import machinery shutting down). For this\\n reason, "__del__()" methods should do the absolute minimum needed\\n to maintain external invariants. Starting with version 1.5,\\n Python guarantees that globals whose name begins with a single\\n underscore are deleted from their module before other globals are\\n deleted; if no other references to such globals exist, this may\\n help in assuring that imported modules are still available at the\\n time when the "__del__()" method is called.\\n\\n See also the "-R" command-line option.\\n\\nobject.__repr__(self)\\n\\n Called by the "repr()" built-in function and by string conversions\\n (reverse quotes) to compute the "official" string representation of\\n an object. If at all possible, this should look like a valid\\n Python expression that could be used to recreate an object with the\\n same value (given an appropriate environment). If this is not\\n possible, a string of the form "<...some useful description...>"\\n should be returned. The return value must be a string object. If a\\n class defines "__repr__()" but not "__str__()", then "__repr__()"\\n is also used when an "informal" string representation of instances\\n of that class is required.\\n\\n This is typically used for debugging, so it is important that the\\n representation is information-rich and unambiguous.\\n\\nobject.__str__(self)\\n\\n Called by the "str()" built-in function and by the "print"\\n statement to compute the "informal" string representation of an\\n object. This differs from "__repr__()" in that it does not have to\\n be a valid Python expression: a more convenient or concise\\n representation may be used instead. The return value must be a\\n string 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\\n New in version 2.1.\\n\\n These are the so-called "rich comparison" methods, and are called\\n for comparison operators in preference to "__cmp__()" below. The\\n correspondence between operator symbols and method names is as\\n follows: "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\\n A rich comparison method may return the singleton "NotImplemented"\\n if it does not implement the operation for a given pair of\\n arguments. By convention, "False" and "True" are returned for a\\n successful comparison. However, these methods can return any value,\\n so if the comparison operator is used in a Boolean context (e.g.,\\n in the condition of an "if" statement), Python will call "bool()"\\n on the value to determine if the result is true or false.\\n\\n There are no implied relationships among the comparison operators.\\n The truth of "x==y" does not imply that "x!=y" is false.\\n Accordingly, when defining "__eq__()", one should also define\\n "__ne__()" so that the operators will behave as expected. See the\\n paragraph on "__hash__()" for some important notes on creating\\n *hashable* objects which support custom comparison operations and\\n are usable as dictionary keys.\\n\\n There are no swapped-argument versions of these methods (to be used\\n when the left argument does not support the operation but the right\\n argument does); rather, "__lt__()" and "__gt__()" are each other\\'s\\n reflection, "__le__()" and "__ge__()" are each other\\'s reflection,\\n and "__eq__()" and "__ne__()" are their own reflection.\\n\\n Arguments to rich comparison methods are never coerced.\\n\\n To automatically generate ordering operations from a single root\\n operation, see "functools.total_ordering()".\\n\\nobject.__cmp__(self, other)\\n\\n Called by comparison operations if rich comparison (see above) is\\n not defined. Should return a negative integer if "self < other",\\n zero if "self == other", a positive integer if "self > other". If\\n no "__cmp__()", "__eq__()" or "__ne__()" operation is defined,\\n class instances are compared by object identity ("address"). See\\n also the description of "__hash__()" for some important notes on\\n creating *hashable* objects which support custom comparison\\n operations and are usable as dictionary keys. (Note: the\\n restriction that exceptions are not propagated by "__cmp__()" has\\n been removed since Python 1.5.)\\n\\nobject.__rcmp__(self, other)\\n\\n Changed in version 2.1: No longer supported.\\n\\nobject.__hash__(self)\\n\\n Called by built-in function "hash()" and for operations on members\\n of hashed collections including "set", "frozenset", and "dict".\\n "__hash__()" should return an integer. The only required property\\n is that objects which compare equal have the same hash value; it is\\n advised to somehow mix together (e.g. using exclusive or) the hash\\n values for the components of the object that also play a part in\\n comparison of objects.\\n\\n If a class does not define a "__cmp__()" or "__eq__()" method it\\n should not define a "__hash__()" operation either; if it defines\\n "__cmp__()" or "__eq__()" but not "__hash__()", its instances will\\n not be usable in hashed collections. If a class defines mutable\\n objects and implements a "__cmp__()" or "__eq__()" method, it\\n should not implement "__hash__()", since hashable collection\\n implementations require that a object\\'s hash value is immutable (if\\n the object\\'s hash value changes, it will be in the wrong hash\\n bucket).\\n\\n User-defined classes have "__cmp__()" and "__hash__()" methods by\\n default; with them, all objects compare unequal (except with\\n themselves) and "x.__hash__()" returns a result derived from\\n "id(x)".\\n\\n Classes which inherit a "__hash__()" method from a parent class but\\n change the meaning of "__cmp__()" or "__eq__()" such that the hash\\n value returned is no longer appropriate (e.g. by switching to a\\n value-based concept of equality instead of the default identity\\n based equality) can explicitly flag themselves as being unhashable\\n by setting "__hash__ = None" in the class definition. Doing so\\n means that not only will instances of the class raise an\\n appropriate "TypeError" when a program attempts to retrieve their\\n hash value, but they will also be correctly identified as\\n unhashable when checking "isinstance(obj, collections.Hashable)"\\n (unlike classes which define their own "__hash__()" to explicitly\\n raise "TypeError").\\n\\n Changed in version 2.5: "__hash__()" may now also return a long\\n integer object; the 32-bit integer is then derived from the hash of\\n that object.\\n\\n Changed in version 2.6: "__hash__" may now be set to "None" to\\n explicitly flag instances of a class as unhashable.\\n\\nobject.__nonzero__(self)\\n\\n Called to implement truth value testing and the built-in operation\\n "bool()"; should return "False" or "True", or their integer\\n equivalents "0" or "1". When this method is not defined,\\n "__len__()" is called, if it is defined, and the object is\\n considered true if its result is nonzero. If a class defines\\n neither "__len__()" nor "__nonzero__()", all its instances are\\n considered true.\\n\\nobject.__unicode__(self)\\n\\n Called to implement "unicode()" built-in; should return a Unicode\\n object. When this method is not defined, string conversion is\\n attempted, and the result of string conversion is converted to\\n Unicode using the system default encoding.\\n', namespace
[all...]
/device/linaro/bootloader/edk2/AppPkg/Applications/Python/Python-2.7.2/Lib/pydoc_data/
H A Dtopics.py6 '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``)\nfor class instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for ``self``). ``name`` is the attribute name.\n This method should return the (computed) attribute value or raise\n an ``AttributeError`` exception.\n\n Note that if the attribute is found through the normal mechanism,\n ``__getattr__()`` is not called. (This is an intentional asymmetry\n between ``__getattr__()`` and ``__setattr__()``.) This is done both\n for efficiency reasons and because otherwise ``__getattr__()``\n would have no way to access other attributes of the instance. Note\n that at least for instance variables, you can fake total control by\n not inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n ``__getattribute__()`` method below for a way to actually get total\n control in new-style classes.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If ``__setattr__()`` wants to assign to an instance attribute, it\n should not simply execute ``self.name = value`` --- this would\n cause a recursive call to itself. Instead, it should insert the\n value in the dictionary of instance attributes, e.g.,\n ``self.__dict__[name] = value``. For new-style classes, rather\n than accessing the instance dictionary, it should call the base\n class method with the same name, for example,\n ``object.__setattr__(self, name, value)``.\n\nobject.__delattr__(self, name)\n\n Like ``__setattr__()`` but for attribute deletion instead of\n assignment. This should only be implemented if ``del obj.name`` is\n meaningful 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\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines\n ``__getattr__()``, the latter will not be called unless\n ``__getattribute__()`` either calls it explicitly or raises an\n ``AttributeError``. This method should return the (computed)\n attribute value or raise an ``AttributeError`` exception. In order\n to avoid infinite recursion in this method, its implementation\n should always call the base class method with the same name to\n access any attributes it needs, for example,\n ``object.__getattribute__(self, name)``.\n\n Note: This method may still be bypassed when looking up special methods\n as the result of implicit invocation via language syntax or\n built-in functions. See *Special method lookup for new-style\n classes*.\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\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or ``None`` when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an\n ``AttributeError`` exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner 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,\nit is 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\n``type()``).\n\nThe starting point for descriptor invocation is a binding, ``a.x``.\nHow the arguments are assembled depends on ``a``:\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: ``x.__get__(a)``.\n\nInstance Binding\n If binding to a new-style object instance, ``a.x`` is transformed\n into the call: ``type(a).__dict__[\'x\'].__get__(a, type(a))``.\n\nClass Binding\n If binding to a new-style class, ``A.x`` is transformed into the\n call: ``A.__dict__[\'x\'].__get__(None, A)``.\n\nSuper Binding\n If ``a`` is an instance of ``super``, then the binding ``super(B,\n obj).m()`` searches ``obj.__class__.__mro__`` for the base class\n ``A`` immediately preceding ``B`` and then invokes the descriptor\n with the call: ``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__()``.\nIf it does not define ``__get__()``, then accessing the attribute will\nreturn the descriptor object itself unless there is a value in the\nobject\'s instance dictionary. If the descriptor defines ``__set__()``\nand/or ``__delete__()``, it is a data descriptor; if it defines\nneither, it is a non-data descriptor. Normally, data descriptors\ndefine both ``__get__()`` and ``__set__()``, while non-data\ndescriptors have just the ``__get__()`` method. Data descriptors with\n``__set__()`` and ``__get__()`` defined always override a redefinition\nin an instance dictionary. In contrast, non-data descriptors can be\noverridden by instances.\n\nPython methods (includin
27 'customization': u'\\nBasic customization\\n*******************\\n\\nobject.__new__(cls[, ...])\\n\\n Called to create a new instance of class *cls*. ``__new__()`` is a\\n static method (special-cased so you need not declare it as such)\\n that takes the class of which an instance was requested as its\\n first argument. The remaining arguments are those passed to the\\n object constructor expression (the call to the class). The return\\n value of ``__new__()`` should be the new object instance (usually\\n an instance of *cls*).\\n\\n Typical implementations create a new instance of the class by\\n invoking the superclass\\'s ``__new__()`` method using\\n ``super(currentclass, cls).__new__(cls[, ...])`` with appropriate\\n arguments and then modifying the newly-created instance as\\n necessary before returning it.\\n\\n If ``__new__()`` returns an instance of *cls*, then the new\\n instance\\'s ``__init__()`` method will be invoked like\\n ``__init__(self[, ...])``, where *self* is the new instance and the\\n remaining arguments are the same as were passed to ``__new__()``.\\n\\n If ``__new__()`` does not return an instance of *cls*, then the new\\n instance\\'s ``__init__()`` method will not be invoked.\\n\\n ``__new__()`` is intended mainly to allow subclasses of immutable\\n types (like int, str, or tuple) to customize instance creation. It\\n is also commonly overridden in custom metaclasses in order to\\n customize class creation.\\n\\nobject.__init__(self[, ...])\\n\\n Called when the instance is created. The arguments are those\\n passed to the class constructor expression. If a base class has an\\n ``__init__()`` method, the derived class\\'s ``__init__()`` method,\\n if any, must explicitly call it to ensure proper initialization of\\n the base class part of the instance; for example:\\n ``BaseClass.__init__(self, [args...])``. As a special constraint\\n on constructors, no value may be returned; doing so will cause a\\n ``TypeError`` to be raised at runtime.\\n\\nobject.__del__(self)\\n\\n Called when the instance is about to be destroyed. This is also\\n called a destructor. If a base class has a ``__del__()`` method,\\n the derived class\\'s ``__del__()`` method, if any, must explicitly\\n call it to ensure proper deletion of the base class part of the\\n instance. Note that it is possible (though not recommended!) for\\n the ``__del__()`` method to postpone destruction of the instance by\\n creating a new reference to it. It may then be called at a later\\n time when this new reference is deleted. It is not guaranteed that\\n ``__del__()`` methods are called for objects that still exist when\\n the interpreter exits.\\n\\n Note: ``del x`` doesn\\'t directly call ``x.__del__()`` --- the former\\n decrements the reference count for ``x`` by one, and the latter\\n is only called when ``x``\\'s reference count reaches zero. Some\\n common situations that may prevent the reference count of an\\n object from going to zero include: circular references between\\n objects (e.g., a doubly-linked list or a tree data structure with\\n parent and child pointers); a reference to the object on the\\n stack frame of a function that caught an exception (the traceback\\n stored in ``sys.exc_traceback`` keeps the stack frame alive); or\\n a reference to the object on the stack frame that raised an\\n unhandled exception in interactive mode (the traceback stored in\\n ``sys.last_traceback`` keeps the stack frame alive). The first\\n situation can only be remedied by explicitly breaking the cycles;\\n the latter two situations can be resolved by storing ``None`` in\\n ``sys.exc_traceback`` or ``sys.last_traceback``. Circular\\n references which are garbage are detected when the option cycle\\n detector is enabled (it\\'s on by default), but can only be cleaned\\n up if there are no Python-level ``__del__()`` methods involved.\\n Refer to the documentation for the ``gc`` module for more\\n information about how ``__del__()`` methods are handled by the\\n cycle detector, particularly the description of the ``garbage``\\n value.\\n\\n Warning: Due to the precarious circumstances under which ``__del__()``\\n methods are invoked, exceptions that occur during their execution\\n are ignored, and a warning is printed to ``sys.stderr`` instead.\\n Also, when ``__del__()`` is invoked in response to a module being\\n deleted (e.g., when execution of the program is done), other\\n globals referenced by the ``__del__()`` method may already have\\n been deleted or in the process of being torn down (e.g. the\\n import machinery shutting down). For this reason, ``__del__()``\\n methods should do the absolute minimum needed to maintain\\n external invariants. Starting with version 1.5, Python\\n guarantees that globals whose name begins with a single\\n underscore are deleted from their module before other globals are\\n deleted; if no other references to such globals exist, this may\\n help in assuring that imported modules are still available at the\\n time when the ``__del__()`` method is called.\\n\\nobject.__repr__(self)\\n\\n Called by the ``repr()`` built-in function and by string\\n conversions (reverse quotes) to compute the "official" string\\n representation of an object. If at all possible, this should look\\n like a valid Python expression that could be used to recreate an\\n object with the same value (given an appropriate environment). If\\n this is not possible, a string of the form ``<...some useful\\n description...>`` should be returned. The return value must be a\\n string object. If a class defines ``__repr__()`` but not\\n ``__str__()``, then ``__repr__()`` is also used when an "informal"\\n string representation of instances of that class is required.\\n\\n This is typically used for debugging, so it is important that the\\n representation is information-rich and unambiguous.\\n\\nobject.__str__(self)\\n\\n Called by the ``str()`` built-in function and by the ``print``\\n statement to compute the "informal" string representation of an\\n object. This differs from ``__repr__()`` in that it does not have\\n to be a valid Python expression: a more convenient or concise\\n representation may be used instead. The return value must be a\\n string 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\\n New in version 2.1.\\n\\n These are the so-called "rich comparison" methods, and are called\\n for comparison operators in preference to ``__cmp__()`` below. The\\n correspondence between operator symbols and method names is as\\n follows: ``x<y`` calls ``x.__lt__(y)``, ``x<=y`` calls\\n ``x.__le__(y)``, ``x==y`` calls ``x.__eq__(y)``, ``x!=y`` and\\n ``x<>y`` call ``x.__ne__(y)``, ``x>y`` calls ``x.__gt__(y)``, and\\n ``x>=y`` calls ``x.__ge__(y)``.\\n\\n A rich comparison method may return the singleton\\n ``NotImplemented`` if it does not implement the operation for a\\n given pair of arguments. By convention, ``False`` and ``True`` are\\n returned for a successful comparison. However, these methods can\\n return any value, so if the comparison operator is used in a\\n Boolean context (e.g., in the condition of an ``if`` statement),\\n Python will call ``bool()`` on the value to determine if the result\\n is true or false.\\n\\n There are no implied relationships among the comparison operators.\\n The truth of ``x==y`` does not imply that ``x!=y`` is false.\\n Accordingly, when defining ``__eq__()``, one should also define\\n ``__ne__()`` so that the operators will behave as expected. See\\n the paragraph on ``__hash__()`` for some important notes on\\n creating *hashable* objects which support custom comparison\\n operations and are usable as dictionary keys.\\n\\n There are no swapped-argument versions of these methods (to be used\\n when the left argument does not support the operation but the right\\n argument does); rather, ``__lt__()`` and ``__gt__()`` are each\\n other\\'s reflection, ``__le__()`` and ``__ge__()`` are each other\\'s\\n reflection, and ``__eq__()`` and ``__ne__()`` are their own\\n reflection.\\n\\n Arguments to rich comparison methods are never coerced.\\n\\n To automatically generate ordering operations from a single root\\n operation, see ``functools.total_ordering()``.\\n\\nobject.__cmp__(self, other)\\n\\n Called by comparison operations if rich comparison (see above) is\\n not defined. Should return a negative integer if ``self < other``,\\n zero if ``self == other``, a positive integer if ``self > other``.\\n If no ``__cmp__()``, ``__eq__()`` or ``__ne__()`` operation is\\n defined, class instances are compared by object identity\\n ("address"). See also the description of ``__hash__()`` for some\\n important notes on creating *hashable* objects which support custom\\n comparison operations and are usable as dictionary keys. (Note: the\\n restriction that exceptions are not propagated by ``__cmp__()`` has\\n been removed since Python 1.5.)\\n\\nobject.__rcmp__(self, other)\\n\\n Changed in version 2.1: No longer supported.\\n\\nobject.__hash__(self)\\n\\n Called by built-in function ``hash()`` and for operations on\\n members of hashed collections including ``set``, ``frozenset``, and\\n ``dict``. ``__hash__()`` should return an integer. The only\\n required property is that objects which compare equal have the same\\n hash value; it is advised to somehow mix together (e.g. using\\n exclusive or) the hash values for the components of the object that\\n also play a part in comparison of objects.\\n\\n If a class does not define a ``__cmp__()`` or ``__eq__()`` method\\n it should not define a ``__hash__()`` operation either; if it\\n defines ``__cmp__()`` or ``__eq__()`` but not ``__hash__()``, its\\n instances will not be usable in hashed collections. If a class\\n defines mutable objects and implements a ``__cmp__()`` or\\n ``__eq__()`` method, it should not implement ``__hash__()``, since\\n hashable collection implementations require that a object\\'s hash\\n value is immutable (if the object\\'s hash value changes, it will be\\n in the wrong hash bucket).\\n\\n User-defined classes have ``__cmp__()`` and ``__hash__()`` methods\\n by default; with them, all objects compare unequal (except with\\n themselves) and ``x.__hash__()`` returns ``id(x)``.\\n\\n Classes which inherit a ``__hash__()`` method from a parent class\\n but change the meaning of ``__cmp__()`` or ``__eq__()`` such that\\n the hash value returned is no longer appropriate (e.g. by switching\\n to a value-based concept of equality instead of the default\\n identity based equality) can explicitly flag themselves as being\\n unhashable by setting ``__hash__ = None`` in the class definition.\\n Doing so means that not only will instances of the class raise an\\n appropriate ``TypeError`` when a program attempts to retrieve their\\n hash value, but they will also be correctly identified as\\n unhashable when checking ``isinstance(obj, collections.Hashable)``\\n (unlike classes which define their own ``__hash__()`` to explicitly\\n raise ``TypeError``).\\n\\n Changed in version 2.5: ``__hash__()`` may now also return a long\\n integer object; the 32-bit integer is then derived from the hash of\\n that object.\\n\\n Changed in version 2.6: ``__hash__`` may now be set to ``None`` to\\n explicitly flag instances of a class as unhashable.\\n\\nobject.__nonzero__(self)\\n\\n Called to implement truth value testing and the built-in operation\\n ``bool()``; should return ``False`` or ``True``, or their integer\\n equivalents ``0`` or ``1``. When this method is not defined,\\n ``__len__()`` is called, if it is defined, and the object is\\n considered true if its result is nonzero. If a class defines\\n neither ``__len__()`` nor ``__nonzero__()``, all its instances are\\n considered true.\\n\\nobject.__unicode__(self)\\n\\n Called to implement ``unicode()`` built-in; should return a Unicode\\n object. When this method is not defined, string conversion is\\n attempted, and the result of string conversion is converted to\\n Unicode using the system default encoding.\\n', namespace
[all...]

Completed in 238 milliseconds