summaryrefslogtreecommitdiffstats
path: root/Lib/pydoc_data
diff options
context:
space:
mode:
authorNed Deily <nad@python.org>2018-03-14 01:21:36 (GMT)
committerNed Deily <nad@python.org>2018-03-14 01:21:36 (GMT)
commitf03c5148cfc6873df855bd0edca2940f9a5d8fd5 (patch)
tree25195ee1c3796194136284227cbd5174d2920270 /Lib/pydoc_data
parent94552448d7bcc1eebc53b608e89d96e235054f2f (diff)
downloadcpython-f03c5148cfc6873df855bd0edca2940f9a5d8fd5.zip
cpython-f03c5148cfc6873df855bd0edca2940f9a5d8fd5.tar.gz
cpython-f03c5148cfc6873df855bd0edca2940f9a5d8fd5.tar.bz2
3.6.5rc1v3.6.5rc1
Diffstat (limited to 'Lib/pydoc_data')
-rw-r--r--Lib/pydoc_data/topics.py609
1 files changed, 367 insertions, 242 deletions
diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py
index 8dc41a2..f37e672 100644
--- a/Lib/pydoc_data/topics.py
+++ b/Lib/pydoc_data/topics.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Autogenerated by Sphinx on Tue Dec 5 03:11:02 2017
+# Autogenerated by Sphinx on Tue Mar 13 21:13:16 2018
topics = {'assert': 'The "assert" statement\n'
'**********************\n'
'\n'
@@ -483,15 +483,19 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'object.__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'
+ ' Called when the default attribute access fails with '
+ 'an\n'
+ ' "AttributeError" (either "__getattribute__()" raises '
+ 'an\n'
+ ' "AttributeError" because *name* is not an instance '
+ 'attribute or an\n'
+ ' attribute in the class tree for "self"; or '
+ '"__get__()" of a *name*\n'
+ ' property raises "AttributeError"). This method '
+ 'should either\n'
+ ' return the (computed) attribute value or raise an '
+ '"AttributeError"\n'
+ ' exception.\n'
'\n'
' Note that if the attribute is found through the '
'normal mechanism,\n'
@@ -571,6 +575,41 @@ topics = {'assert': 'The "assert" statement\n'
' sorts it.\n'
'\n'
'\n'
+ 'Customizing module attribute access\n'
+ '===================================\n'
+ '\n'
+ 'For a more fine grained customization of the module '
+ 'behavior (setting\n'
+ 'attributes, properties, etc.), one can set the '
+ '"__class__" attribute\n'
+ 'of a module object to a subclass of "types.ModuleType". '
+ 'For example:\n'
+ '\n'
+ ' import sys\n'
+ ' from types import ModuleType\n'
+ '\n'
+ ' class VerboseModule(ModuleType):\n'
+ ' def __repr__(self):\n'
+ " return f'Verbose {self.__name__}'\n"
+ '\n'
+ ' def __setattr__(self, attr, value):\n'
+ " print(f'Setting {attr}...')\n"
+ ' setattr(self, attr, value)\n'
+ '\n'
+ ' sys.modules[__name__].__class__ = VerboseModule\n'
+ '\n'
+ 'Note: Setting module "__class__" only affects lookups '
+ 'made using the\n'
+ ' attribute access syntax -- directly accessing the '
+ 'module globals\n'
+ ' (whether by code within the module, or via a reference '
+ 'to the\n'
+ " module's globals dictionary) is unaffected.\n"
+ '\n'
+ 'Changed in version 3.5: "__class__" module attribute is '
+ 'now writable.\n'
+ '\n'
+ '\n'
'Implementing Descriptors\n'
'========================\n'
'\n'
@@ -742,23 +781,15 @@ topics = {'assert': 'The "assert" statement\n'
'__slots__\n'
'=========\n'
'\n'
- 'By default, instances of classes have a dictionary for '
- 'attribute\n'
- 'storage. This wastes space for objects having very few '
- 'instance\n'
- 'variables. The space consumption can become acute when '
- 'creating large\n'
- 'numbers of instances.\n'
+ '*__slots__* allow us to explicitly declare data members '
+ '(like\n'
+ 'properties) and deny the creation of *__dict__* and '
+ '*__weakref__*\n'
+ '(unless explicitly declared in *__slots__* or available '
+ 'in a parent.)\n'
'\n'
- 'The default can be overridden by defining *__slots__* in '
- 'a class\n'
- 'definition. The *__slots__* declaration takes a sequence '
- 'of instance\n'
- 'variables and reserves just enough space in each '
- 'instance to hold a\n'
- 'value for each variable. Space is saved because '
- '*__dict__* is not\n'
- 'created for each instance.\n'
+ 'The space saved over using *__dict__* can be '
+ 'significant.\n'
'\n'
'object.__slots__\n'
'\n'
@@ -778,9 +809,9 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'* When inheriting from a class without *__slots__*, the '
'*__dict__*\n'
- ' attribute of that class will always be accessible, so '
- 'a *__slots__*\n'
- ' definition in the subclass is meaningless.\n'
+ ' and *__weakref__* attribute of the instances will '
+ 'always be\n'
+ ' accessible.\n'
'\n'
'* Without a *__dict__* variable, instances cannot be '
'assigned new\n'
@@ -814,13 +845,16 @@ topics = {'assert': 'The "assert" statement\n'
'the class\n'
' attribute would overwrite the descriptor assignment.\n'
'\n'
- '* The action of a *__slots__* declaration is limited to '
- 'the class\n'
- ' where it is defined. As a result, subclasses will '
- 'have a *__dict__*\n'
- ' unless they also define *__slots__* (which must only '
- 'contain names\n'
- ' of any *additional* slots).\n'
+ '* The action of a *__slots__* declaration is not limited '
+ 'to the\n'
+ ' class where it is defined. *__slots__* declared in '
+ 'parents are\n'
+ ' available in child classes. However, child subclasses '
+ 'will get a\n'
+ ' *__dict__* and *__weakref__* unless they also define '
+ '*__slots__*\n'
+ ' (which should only contain names of any *additional* '
+ 'slots).\n'
'\n'
'* If a class defines a slot also defined in a base '
'class, the\n'
@@ -845,7 +879,15 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'* *__class__* assignment works only if both classes have '
'the same\n'
- ' *__slots__*.\n',
+ ' *__slots__*.\n'
+ '\n'
+ '* Multiple inheritance with multiple slotted parent '
+ 'classes can be\n'
+ ' used, but only one parent is allowed to have '
+ 'attributes created by\n'
+ ' slots (the other bases must have empty slot layouts) - '
+ 'violations\n'
+ ' raise "TypeError".\n',
'attribute-references': 'Attribute references\n'
'********************\n'
'\n'
@@ -2893,63 +2935,52 @@ topics = {'assert': 'The "assert" statement\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 '
+ ' called a finalizer or (improperly) a destructor. If a '
+ 'base class\n'
+ ' has a "__del__()" method, the derived class\'s '
+ '"__del__()" method,\n'
+ ' if any, must explicitly call it to ensure proper '
+ 'deletion of the\n'
+ ' base class part of the instance.\n'
+ '\n'
+ ' It is possible (though not recommended!) for the '
+ '"__del__()" method\n'
+ ' to postpone destruction of the instance by creating a '
+ 'new reference\n'
+ ' to it. This is called object *resurrection*. It is\n'
+ ' implementation-dependent whether "__del__()" is called a '
+ 'second\n'
+ ' time when a resurrected object is about to be destroyed; '
'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'
+ ' current *CPython* implementation only calls it once.\n'
+ '\n'
+ ' It is not guaranteed that "__del__()" methods are called '
+ 'for\n'
+ ' objects that still exist when 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_info()[2]" keeps the stack frame alive); or a '
+ ' only called when "x"\'s reference count reaches zero.\n'
+ '\n'
+ ' **CPython implementation detail:** It is possible for 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 second can be resolved by freeing the reference to '
- 'the\n'
- ' traceback object when it is no longer useful, and the '
- 'third can\n'
- ' be resolved by storing "None" in "sys.last_traceback". '
- 'Circular\n'
- ' references which are garbage are detected and cleaned '
- 'up when the\n'
- " cyclic garbage collector is enabled (it's on by "
- 'default). Refer\n'
- ' to the documentation for the "gc" module for more '
- 'information\n'
- ' about this topic.\n'
+ ' cycle to prevent the reference count of an object from '
+ 'going to\n'
+ ' zero. In this case, the cycle will be later detected '
+ 'and deleted\n'
+ ' by the *cyclic garbage collector*. A common cause of '
+ 'reference\n'
+ ' cycles is when an exception has been caught in a local '
+ 'variable.\n'
+ " The frame's locals then reference the exception, which "
+ 'references\n'
+ ' its own traceback, which references the locals of all '
+ 'frames caught\n'
+ ' in the traceback.\n'
+ '\n'
+ ' See also: Documentation for the "gc" module.\n'
'\n'
' Warning: Due to the precarious circumstances under '
'which\n'
@@ -2957,29 +2988,35 @@ topics = {'assert': 'The "assert" statement\n'
'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 '
+ ' "sys.stderr" instead. In particular:\n'
+ '\n'
+ ' * "__del__()" can be invoked when arbitrary code is '
+ 'being\n'
+ ' executed, including from any arbitrary thread. If '
'"__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'
+ ' needs to take a lock or invoke any other blocking '
+ 'resource, it\n'
+ ' may deadlock as the resource may already be taken by '
+ 'the code\n'
+ ' that gets interrupted to execute "__del__()".\n'
+ '\n'
+ ' * "__del__()" can be executed during interpreter '
+ 'shutdown. As\n'
+ ' a consequence, the global variables it needs to '
+ 'access\n'
+ ' (including other modules) may already have been '
+ 'deleted or set\n'
+ ' to "None". Python guarantees that globals whose name '
+ 'begins\n'
+ ' with a single underscore are deleted from their '
+ 'module before\n'
+ ' other globals are deleted; if no other references to '
+ 'such\n'
+ ' globals exist, this may help in assuring that '
+ 'imported modules\n'
+ ' are still available at the time when the "__del__()" '
+ 'method is\n'
+ ' called.\n'
'\n'
'object.__repr__(self)\n'
'\n'
@@ -4606,9 +4643,9 @@ topics = {'assert': 'The "assert" statement\n'
'conversion] [":" format_spec] "}"\n'
' field_name ::= arg_name ("." attribute_name | '
'"[" element_index "]")*\n'
- ' arg_name ::= [identifier | integer]\n'
+ ' arg_name ::= [identifier | digit+]\n'
' attribute_name ::= identifier\n'
- ' element_index ::= integer | index_string\n'
+ ' element_index ::= digit+ | index_string\n'
' index_string ::= <any source character except '
'"]"> +\n'
' conversion ::= "r" | "s" | "a"\n'
@@ -4767,9 +4804,9 @@ topics = {'assert': 'The "assert" statement\n'
' fill ::= <any character>\n'
' align ::= "<" | ">" | "=" | "^"\n'
' sign ::= "+" | "-" | " "\n'
- ' width ::= integer\n'
+ ' width ::= digit+\n'
' grouping_option ::= "_" | ","\n'
- ' precision ::= integer\n'
+ ' precision ::= digit+\n'
' type ::= "b" | "c" | "d" | "e" | "E" | "f" | '
'"F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"\n'
'\n'
@@ -6523,13 +6560,11 @@ topics = {'assert': 'The "assert" statement\n'
'object.__complex__(self)\n'
'object.__int__(self)\n'
'object.__float__(self)\n'
- 'object.__round__(self[, n])\n'
'\n'
' Called to implement the built-in functions "complex()", '
- '"int()",\n'
- ' "float()" and "round()". Should return a value of the '
- 'appropriate\n'
- ' type.\n'
+ '"int()" and\n'
+ ' "float()". Should return a value of the appropriate '
+ 'type.\n'
'\n'
'object.__index__(self)\n'
'\n'
@@ -6547,7 +6582,25 @@ topics = {'assert': 'The "assert" statement\n'
'when\n'
' "__index__()" is defined "__int__()" should also be '
'defined, and\n'
- ' both should return the same value.\n',
+ ' both should return the same value.\n'
+ '\n'
+ 'object.__round__(self[, ndigits])\n'
+ 'object.__trunc__(self)\n'
+ 'object.__floor__(self)\n'
+ 'object.__ceil__(self)\n'
+ '\n'
+ ' Called to implement the built-in function "round()" and '
+ '"math"\n'
+ ' functions "trunc()", "floor()" and "ceil()". Unless '
+ '*ndigits* is\n'
+ ' passed to "__round__()" all these methods should return '
+ 'the value\n'
+ ' of the object truncated to an "Integral" (typically an '
+ '"int").\n'
+ '\n'
+ ' If "__int__()" is not defined then the built-in function '
+ '"int()"\n'
+ ' falls back to "__trunc__()".\n',
'objects': 'Objects, values and types\n'
'*************************\n'
'\n'
@@ -7548,91 +7601,87 @@ topics = {'assert': 'The "assert" statement\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 '
+ ' called a finalizer or (improperly) a destructor. If a '
+ 'base class\n'
+ ' has a "__del__()" method, the derived class\'s '
+ '"__del__()" method,\n'
+ ' if any, must explicitly call it to ensure proper deletion '
+ 'of the\n'
+ ' base class part of the instance.\n'
+ '\n'
+ ' It is possible (though not recommended!) for the '
+ '"__del__()" method\n'
+ ' to postpone destruction of the instance by creating a new '
+ 'reference\n'
+ ' to it. This is called object *resurrection*. It is\n'
+ ' implementation-dependent whether "__del__()" is called a '
+ 'second\n'
+ ' time when a resurrected object is about to be destroyed; '
'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'
+ ' current *CPython* implementation only calls it once.\n'
+ '\n'
+ ' It is not guaranteed that "__del__()" methods are called '
+ 'for\n'
+ ' objects that still exist when 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_info()[2]" keeps the stack frame alive); or a '
+ ' only called when "x"\'s reference count reaches zero.\n'
+ '\n'
+ ' **CPython implementation detail:** It is possible for 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 second can be resolved by freeing the reference to '
- 'the\n'
- ' traceback object when it is no longer useful, and the '
- 'third can\n'
- ' be resolved by storing "None" in "sys.last_traceback". '
- 'Circular\n'
- ' references which are garbage are detected and cleaned '
- 'up when the\n'
- " cyclic garbage collector is enabled (it's on by "
- 'default). Refer\n'
- ' to the documentation for the "gc" module for more '
- 'information\n'
- ' about this topic.\n'
+ ' cycle to prevent the reference count of an object from '
+ 'going to\n'
+ ' zero. In this case, the cycle will be later detected and '
+ 'deleted\n'
+ ' by the *cyclic garbage collector*. A common cause of '
+ 'reference\n'
+ ' cycles is when an exception has been caught in a local '
+ 'variable.\n'
+ " The frame's locals then reference the exception, which "
+ 'references\n'
+ ' its own traceback, which references the locals of all '
+ 'frames caught\n'
+ ' in the traceback.\n'
+ '\n'
+ ' See also: Documentation for the "gc" module.\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 '
+ ' "sys.stderr" instead. In particular:\n'
+ '\n'
+ ' * "__del__()" can be invoked when arbitrary code is '
+ 'being\n'
+ ' executed, including from any arbitrary thread. If '
'"__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'
+ ' needs to take a lock or invoke any other blocking '
+ 'resource, it\n'
+ ' may deadlock as the resource may already be taken by '
+ 'the code\n'
+ ' that gets interrupted to execute "__del__()".\n'
+ '\n'
+ ' * "__del__()" can be executed during interpreter '
+ 'shutdown. As\n'
+ ' a consequence, the global variables it needs to '
+ 'access\n'
+ ' (including other modules) may already have been '
+ 'deleted or set\n'
+ ' to "None". Python guarantees that globals whose name '
+ 'begins\n'
+ ' with a single underscore are deleted from their '
+ 'module before\n'
+ ' other globals are deleted; if no other references to '
+ 'such\n'
+ ' globals exist, this may help in assuring that '
+ 'imported modules\n'
+ ' are still available at the time when the "__del__()" '
+ 'method is\n'
+ ' called.\n'
'\n'
'object.__repr__(self)\n'
'\n'
@@ -7924,15 +7973,17 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'object.__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'
+ ' Called when the default attribute access fails with an\n'
+ ' "AttributeError" (either "__getattribute__()" raises an\n'
+ ' "AttributeError" because *name* is not an instance '
+ 'attribute or an\n'
+ ' attribute in the class tree for "self"; or "__get__()" of '
+ 'a *name*\n'
+ ' property raises "AttributeError"). This method should '
+ 'either\n'
+ ' return the (computed) attribute value or raise an '
+ '"AttributeError"\n'
+ ' exception.\n'
'\n'
' Note that if the attribute is found through the normal '
'mechanism,\n'
@@ -8011,6 +8062,41 @@ topics = {'assert': 'The "assert" statement\n'
' sorts it.\n'
'\n'
'\n'
+ 'Customizing module attribute access\n'
+ '-----------------------------------\n'
+ '\n'
+ 'For a more fine grained customization of the module behavior '
+ '(setting\n'
+ 'attributes, properties, etc.), one can set the "__class__" '
+ 'attribute\n'
+ 'of a module object to a subclass of "types.ModuleType". For '
+ 'example:\n'
+ '\n'
+ ' import sys\n'
+ ' from types import ModuleType\n'
+ '\n'
+ ' class VerboseModule(ModuleType):\n'
+ ' def __repr__(self):\n'
+ " return f'Verbose {self.__name__}'\n"
+ '\n'
+ ' def __setattr__(self, attr, value):\n'
+ " print(f'Setting {attr}...')\n"
+ ' setattr(self, attr, value)\n'
+ '\n'
+ ' sys.modules[__name__].__class__ = VerboseModule\n'
+ '\n'
+ 'Note: Setting module "__class__" only affects lookups made '
+ 'using the\n'
+ ' attribute access syntax -- directly accessing the module '
+ 'globals\n'
+ ' (whether by code within the module, or via a reference to '
+ 'the\n'
+ " module's globals dictionary) is unaffected.\n"
+ '\n'
+ 'Changed in version 3.5: "__class__" module attribute is now '
+ 'writable.\n'
+ '\n'
+ '\n'
'Implementing Descriptors\n'
'------------------------\n'
'\n'
@@ -8179,23 +8265,14 @@ topics = {'assert': 'The "assert" statement\n'
'__slots__\n'
'---------\n'
'\n'
- 'By default, instances of classes have a dictionary for '
- 'attribute\n'
- 'storage. This wastes space for objects having very few '
- 'instance\n'
- 'variables. The space consumption can become acute when '
- 'creating large\n'
- 'numbers of instances.\n'
+ '*__slots__* allow us to explicitly declare data members '
+ '(like\n'
+ 'properties) and deny the creation of *__dict__* and '
+ '*__weakref__*\n'
+ '(unless explicitly declared in *__slots__* or available in a '
+ 'parent.)\n'
'\n'
- 'The default can be overridden by defining *__slots__* in a '
- 'class\n'
- 'definition. The *__slots__* declaration takes a sequence of '
- 'instance\n'
- 'variables and reserves just enough space in each instance to '
- 'hold a\n'
- 'value for each variable. Space is saved because *__dict__* '
- 'is not\n'
- 'created for each instance.\n'
+ 'The space saved over using *__dict__* can be significant.\n'
'\n'
'object.__slots__\n'
'\n'
@@ -8215,9 +8292,9 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'* When inheriting from a class without *__slots__*, the '
'*__dict__*\n'
- ' attribute of that class will always be accessible, so a '
- '*__slots__*\n'
- ' definition in the subclass is meaningless.\n'
+ ' and *__weakref__* attribute of the instances will always '
+ 'be\n'
+ ' accessible.\n'
'\n'
'* Without a *__dict__* variable, instances cannot be '
'assigned new\n'
@@ -8249,13 +8326,16 @@ topics = {'assert': 'The "assert" statement\n'
'class\n'
' attribute would overwrite the descriptor assignment.\n'
'\n'
- '* The action of a *__slots__* declaration is limited to the '
- 'class\n'
- ' where it is defined. As a result, subclasses will have a '
- '*__dict__*\n'
- ' unless they also define *__slots__* (which must only '
- 'contain names\n'
- ' of any *additional* slots).\n'
+ '* The action of a *__slots__* declaration is not limited to '
+ 'the\n'
+ ' class where it is defined. *__slots__* declared in '
+ 'parents are\n'
+ ' available in child classes. However, child subclasses will '
+ 'get a\n'
+ ' *__dict__* and *__weakref__* unless they also define '
+ '*__slots__*\n'
+ ' (which should only contain names of any *additional* '
+ 'slots).\n'
'\n'
'* If a class defines a slot also defined in a base class, '
'the\n'
@@ -8282,6 +8362,14 @@ topics = {'assert': 'The "assert" statement\n'
'same\n'
' *__slots__*.\n'
'\n'
+ '* Multiple inheritance with multiple slotted parent classes '
+ 'can be\n'
+ ' used, but only one parent is allowed to have attributes '
+ 'created by\n'
+ ' slots (the other bases must have empty slot layouts) - '
+ 'violations\n'
+ ' raise "TypeError".\n'
+ '\n'
'\n'
'Customizing class creation\n'
'==========================\n'
@@ -9049,13 +9137,11 @@ topics = {'assert': 'The "assert" statement\n'
'object.__complex__(self)\n'
'object.__int__(self)\n'
'object.__float__(self)\n'
- 'object.__round__(self[, n])\n'
'\n'
' Called to implement the built-in functions "complex()", '
- '"int()",\n'
- ' "float()" and "round()". Should return a value of the '
- 'appropriate\n'
- ' type.\n'
+ '"int()" and\n'
+ ' "float()". Should return a value of the appropriate '
+ 'type.\n'
'\n'
'object.__index__(self)\n'
'\n'
@@ -9075,6 +9161,24 @@ topics = {'assert': 'The "assert" statement\n'
'defined, and\n'
' both should return the same value.\n'
'\n'
+ 'object.__round__(self[, ndigits])\n'
+ 'object.__trunc__(self)\n'
+ 'object.__floor__(self)\n'
+ 'object.__ceil__(self)\n'
+ '\n'
+ ' Called to implement the built-in function "round()" and '
+ '"math"\n'
+ ' functions "trunc()", "floor()" and "ceil()". Unless '
+ '*ndigits* is\n'
+ ' passed to "__round__()" all these methods should return '
+ 'the value\n'
+ ' of the object truncated to an "Integral" (typically an '
+ '"int").\n'
+ '\n'
+ ' If "__int__()" is not defined then the built-in function '
+ '"int()"\n'
+ ' falls back to "__trunc__()".\n'
+ '\n'
'\n'
'With Statement Context Managers\n'
'===============================\n'
@@ -9409,6 +9513,27 @@ topics = {'assert': 'The "assert" statement\n'
' formatting options that can be specified in format '
'strings.\n'
'\n'
+ ' Note: When formatting a number ("int", "float", "float" '
+ 'and\n'
+ ' subclasses) with the "n" type (ex: '
+ '"\'{:n}\'.format(1234)"), the\n'
+ ' function sets temporarily the "LC_CTYPE" locale to '
+ 'the\n'
+ ' "LC_NUMERIC" locale to decode "decimal_point" and '
+ '"thousands_sep"\n'
+ ' fields of "localeconv()" if they are non-ASCII or '
+ 'longer than 1\n'
+ ' byte, and the "LC_NUMERIC" locale is different than '
+ 'the\n'
+ ' "LC_CTYPE" locale. This temporary change affects '
+ 'other threads.\n'
+ '\n'
+ ' Changed in version 3.6.5: When formatting a number with '
+ 'the "n"\n'
+ ' type, the function sets temporarily the "LC_CTYPE" '
+ 'locale to the\n'
+ ' "LC_NUMERIC" locale in some cases.\n'
+ '\n'
'str.format_map(mapping)\n'
'\n'
' Similar to "str.format(**mapping)", except that '
@@ -12173,18 +12298,18 @@ topics = {'assert': 'The "assert" statement\n'
' sequence concatenation or repetition.\n'
'\n'
'8. "index" raises "ValueError" when *x* is not found in *s*. '
- 'When\n'
- ' supported, the additional arguments to the index method '
- 'allow\n'
- ' efficient searching of subsections of the sequence. Passing '
- 'the\n'
- ' extra arguments is roughly equivalent to using '
- '"s[i:j].index(x)",\n'
- ' only without copying any data and with the returned index '
- 'being\n'
- ' relative to the start of the sequence rather than the start '
- 'of the\n'
- ' slice.\n'
+ 'Not\n'
+ ' all implementations support passing the additional arguments '
+ '*i*\n'
+ ' and *j*. These arguments allow efficient searching of '
+ 'subsections\n'
+ ' of the sequence. Passing the extra arguments is roughly '
+ 'equivalent\n'
+ ' to using "s[i:j].index(x)", only without copying any data and '
+ 'with\n'
+ ' the returned index being relative to the start of the '
+ 'sequence\n'
+ ' rather than the start of the slice.\n'
'\n'
'\n'
'Immutable Sequence Types\n'