|
1 | 1 | # -*- coding: utf-8 -*- |
2 | | -# Autogenerated by Sphinx on Tue Sep 7 14:18:15 2021 |
| 2 | +# Autogenerated by Sphinx on Mon Oct 4 18:28:12 2021 |
3 | 3 | topics = {'assert': 'The "assert" statement\n' |
4 | 4 | '**********************\n' |
5 | 5 | '\n' |
|
936 | 936 | '*instance* of the\n' |
937 | 937 | ' owner class.\n' |
938 | 938 | '\n' |
939 | | - 'object.__set_name__(self, owner, name)\n' |
940 | | - '\n' |
941 | | - ' Called at the time the owning class *owner* is ' |
942 | | - 'created. The\n' |
943 | | - ' descriptor has been assigned to *name*.\n' |
944 | | - '\n' |
945 | | - ' Note:\n' |
946 | | - '\n' |
947 | | - ' "__set_name__()" is only called implicitly as part ' |
948 | | - 'of the "type"\n' |
949 | | - ' constructor, so it will need to be called ' |
950 | | - 'explicitly with the\n' |
951 | | - ' appropriate parameters when a descriptor is added ' |
952 | | - 'to a class\n' |
953 | | - ' after initial creation:\n' |
954 | | - '\n' |
955 | | - ' class A:\n' |
956 | | - ' pass\n' |
957 | | - ' descr = custom_descriptor()\n' |
958 | | - ' A.attr = descr\n' |
959 | | - " descr.__set_name__(A, 'attr')\n" |
960 | | - '\n' |
961 | | - ' See Creating the class object for more details.\n' |
962 | | - '\n' |
963 | | - ' New in version 3.6.\n' |
964 | | - '\n' |
965 | 939 | 'The attribute "__objclass__" is interpreted by the ' |
966 | 940 | '"inspect" module as\n' |
967 | 941 | 'specifying the class where this object was defined ' |
|
2847 | 2821 | 'have\n' |
2848 | 2822 | ' happened.\n' |
2849 | 2823 | '\n' |
2850 | | - ' * If the guard evaluates as truthy or missing, the "block" ' |
| 2824 | + ' * If the guard evaluates as true or is missing, the "block" ' |
2851 | 2825 | 'inside\n' |
2852 | 2826 | ' "case_block" is executed.\n' |
2853 | 2827 | '\n' |
|
2908 | 2882 | '\n' |
2909 | 2883 | '2. If the pattern succeeded, evaluate the "guard".\n' |
2910 | 2884 | '\n' |
2911 | | - ' * If the "guard" condition evaluates to “truthy”, the case ' |
2912 | | - 'block is\n' |
| 2885 | + ' * If the "guard" condition evaluates as true, the case block ' |
| 2886 | + 'is\n' |
2913 | 2887 | ' selected.\n' |
2914 | 2888 | '\n' |
2915 | | - ' * If the "guard" condition evaluates to “falsy”, the case ' |
2916 | | - 'block is\n' |
| 2889 | + ' * If the "guard" condition evaluates as false, the case block ' |
| 2890 | + 'is\n' |
2917 | 2891 | ' not selected.\n' |
2918 | 2892 | '\n' |
2919 | 2893 | ' * If the "guard" raises an exception during evaluation, the\n' |
|
3417 | 3391 | 'class\n' |
3418 | 3392 | ' "name_or_attr" before matching:\n' |
3419 | 3393 | '\n' |
3420 | | - ' I. The equivalent of "getattr(cls, "__match_args__", ())" ' |
3421 | | - 'is\n' |
| 3394 | + ' I. The equivalent of "getattr(cls, "__match_args__", ())" is\n' |
3422 | 3395 | ' called.\n' |
3423 | 3396 | '\n' |
3424 | 3397 | ' * If this raises an exception, the exception bubbles up.\n' |
|
4148 | 4121 | '\n' |
4149 | 4122 | ' If "__new__()" is invoked during object construction and ' |
4150 | 4123 | 'it returns\n' |
4151 | | - ' an instance or subclass of *cls*, then the new ' |
4152 | | - 'instance’s\n' |
4153 | | - ' "__init__()" method will be invoked like ' |
4154 | | - '"__init__(self[, ...])",\n' |
4155 | | - ' where *self* is the new instance and the remaining ' |
4156 | | - 'arguments are\n' |
4157 | | - ' the same as were passed to the object constructor.\n' |
| 4124 | + ' an instance of *cls*, then the new instance’s ' |
| 4125 | + '"__init__()" method\n' |
| 4126 | + ' will be invoked like "__init__(self[, ...])", where ' |
| 4127 | + '*self* is the\n' |
| 4128 | + ' new instance and the remaining arguments are the same as ' |
| 4129 | + 'were\n' |
| 4130 | + ' passed to the object constructor.\n' |
4158 | 4131 | '\n' |
4159 | 4132 | ' If "__new__()" does not return an instance of *cls*, ' |
4160 | 4133 | 'then the new\n' |
|
9024 | 8997 | '\n' |
9025 | 8998 | ' If "__new__()" is invoked during object construction and ' |
9026 | 8999 | 'it returns\n' |
9027 | | - ' an instance or subclass of *cls*, then the new ' |
9028 | | - 'instance’s\n' |
9029 | | - ' "__init__()" method will be invoked like "__init__(self[, ' |
9030 | | - '...])",\n' |
9031 | | - ' where *self* is the new instance and the remaining ' |
9032 | | - 'arguments are\n' |
9033 | | - ' the same as were passed to the object constructor.\n' |
| 9000 | + ' an instance of *cls*, then the new instance’s ' |
| 9001 | + '"__init__()" method\n' |
| 9002 | + ' will be invoked like "__init__(self[, ...])", where ' |
| 9003 | + '*self* is the\n' |
| 9004 | + ' new instance and the remaining arguments are the same as ' |
| 9005 | + 'were\n' |
| 9006 | + ' passed to the object constructor.\n' |
9034 | 9007 | '\n' |
9035 | 9008 | ' If "__new__()" does not return an instance of *cls*, then ' |
9036 | 9009 | 'the new\n' |
|
9698 | 9671 | 'of the\n' |
9699 | 9672 | ' owner class.\n' |
9700 | 9673 | '\n' |
9701 | | - 'object.__set_name__(self, owner, name)\n' |
9702 | | - '\n' |
9703 | | - ' Called at the time the owning class *owner* is created. ' |
9704 | | - 'The\n' |
9705 | | - ' descriptor has been assigned to *name*.\n' |
9706 | | - '\n' |
9707 | | - ' Note:\n' |
9708 | | - '\n' |
9709 | | - ' "__set_name__()" is only called implicitly as part of ' |
9710 | | - 'the "type"\n' |
9711 | | - ' constructor, so it will need to be called explicitly ' |
9712 | | - 'with the\n' |
9713 | | - ' appropriate parameters when a descriptor is added to a ' |
9714 | | - 'class\n' |
9715 | | - ' after initial creation:\n' |
9716 | | - '\n' |
9717 | | - ' class A:\n' |
9718 | | - ' pass\n' |
9719 | | - ' descr = custom_descriptor()\n' |
9720 | | - ' A.attr = descr\n' |
9721 | | - " descr.__set_name__(A, 'attr')\n" |
9722 | | - '\n' |
9723 | | - ' See Creating the class object for more details.\n' |
9724 | | - '\n' |
9725 | | - ' New in version 3.6.\n' |
9726 | | - '\n' |
9727 | 9674 | 'The attribute "__objclass__" is interpreted by the "inspect" ' |
9728 | 9675 | 'module as\n' |
9729 | 9676 | 'specifying the class where this object was defined (setting ' |
|
10013 | 9960 | '\n' |
10014 | 9961 | ' New in version 3.6.\n' |
10015 | 9962 | '\n' |
| 9963 | + 'When a class is created, "type.__new__()" scans the class ' |
| 9964 | + 'variables\n' |
| 9965 | + 'and makes callbacks to those with a "__set_name__()" hook.\n' |
| 9966 | + '\n' |
| 9967 | + 'object.__set_name__(self, owner, name)\n' |
| 9968 | + '\n' |
| 9969 | + ' Automatically called at the time the owning class *owner* ' |
| 9970 | + 'is\n' |
| 9971 | + ' created. The object has been assigned to *name* in that ' |
| 9972 | + 'class:\n' |
| 9973 | + '\n' |
| 9974 | + ' class A:\n' |
| 9975 | + ' x = C() # Automatically calls: x.__set_name__(A, ' |
| 9976 | + "'x')\n" |
| 9977 | + '\n' |
| 9978 | + ' If the class variable is assigned after the class is ' |
| 9979 | + 'created,\n' |
| 9980 | + ' "__set_name__()" will not be called automatically. If ' |
| 9981 | + 'needed,\n' |
| 9982 | + ' "__set_name__()" can be called directly:\n' |
| 9983 | + '\n' |
| 9984 | + ' class A:\n' |
| 9985 | + ' pass\n' |
| 9986 | + '\n' |
| 9987 | + ' c = C()\n' |
| 9988 | + ' A.x = c # The hook is not called\n' |
| 9989 | + " c.__set_name__(A, 'x') # Manually invoke the hook\n" |
| 9990 | + '\n' |
| 9991 | + ' See Creating the class object for more details.\n' |
| 9992 | + '\n' |
| 9993 | + ' New in version 3.6.\n' |
| 9994 | + '\n' |
10016 | 9995 | '\n' |
10017 | 9996 | 'Metaclasses\n' |
10018 | 9997 | '-----------\n' |
@@ -10208,22 +10187,21 @@ |
10208 | 10187 | 'When using the default metaclass "type", or any metaclass ' |
10209 | 10188 | 'that\n' |
10210 | 10189 | 'ultimately calls "type.__new__", the following additional\n' |
10211 | | - 'customisation steps are invoked after creating the class ' |
| 10190 | + 'customization steps are invoked after creating the class ' |
10212 | 10191 | 'object:\n' |
10213 | 10192 | '\n' |
10214 | | - '* first, "type.__new__" collects all of the descriptors in ' |
10215 | | - 'the class\n' |
10216 | | - ' namespace that define a "__set_name__()" method;\n' |
| 10193 | + '1. The "type.__new__" method collects all of the attributes ' |
| 10194 | + 'in the\n' |
| 10195 | + ' class namespace that define a "__set_name__()" method;\n' |
10217 | 10196 | '\n' |
10218 | | - '* second, all of these "__set_name__" methods are called ' |
10219 | | - 'with the\n' |
10220 | | - ' class being defined and the assigned name of that ' |
10221 | | - 'particular\n' |
10222 | | - ' descriptor;\n' |
| 10197 | + '2. Those "__set_name__" methods are called with the class ' |
| 10198 | + 'being\n' |
| 10199 | + ' defined and the assigned name of that particular ' |
| 10200 | + 'attribute;\n' |
10223 | 10201 | '\n' |
10224 | | - '* finally, the "__init_subclass__()" hook is called on the ' |
10225 | | - 'immediate\n' |
10226 | | - ' parent of the new class in its method resolution order.\n' |
| 10202 | + '3. The "__init_subclass__()" hook is called on the immediate ' |
| 10203 | + 'parent of\n' |
| 10204 | + ' the new class in its method resolution order.\n' |
10227 | 10205 | '\n' |
10228 | 10206 | 'After the class object is created, it is passed to the ' |
10229 | 10207 | 'class\n' |
|
13364 | 13342 | ' variables; "f_globals" is used for global variables;\n' |
13365 | 13343 | ' "f_builtins" is used for built-in (intrinsic) names; ' |
13366 | 13344 | '"f_lasti"\n' |
13367 | | - ' gives the precise instruction (it represents a wordcode ' |
13368 | | - 'index,\n' |
13369 | | - ' which means that to get an index into the bytecode string of ' |
13370 | | - 'the\n' |
13371 | | - ' code object it needs to be multiplied by 2).\n' |
| 13345 | + ' gives the precise instruction (this is an index into the\n' |
| 13346 | + ' bytecode string of the code object).\n' |
13372 | 13347 | '\n' |
13373 | 13348 | ' Accessing "f_code" raises an auditing event ' |
13374 | 13349 | '"object.__getattr__"\n' |
|
0 commit comments