|
1 | | -# Autogenerated by Sphinx on Mon Aug 18 00:55:48 2025 |
| 1 | +# Autogenerated by Sphinx on Mon Aug 18 01:09:13 2025 |
2 | 2 | # as part of the release process. |
3 | 3 |
|
4 | 4 | topics = { |
@@ -4083,43 +4083,6 @@ def f() -> annotation: ... |
4083 | 4083 | Some additional rules apply for certain operators (e.g., a string as a |
4084 | 4084 | left argument to the ‘%’ operator). Extensions must define their own |
4085 | 4085 | conversion behavior. |
4086 | | -''', |
4087 | | - 'custom-instance-subclass': r'''Customizing instance and subclass checks |
4088 | | -**************************************** |
4089 | | - |
4090 | | -The following methods are used to override the default behavior of the |
4091 | | -"isinstance()" and "issubclass()" built-in functions. |
4092 | | - |
4093 | | -In particular, the metaclass "abc.ABCMeta" implements these methods in |
4094 | | -order to allow the addition of Abstract Base Classes (ABCs) as |
4095 | | -“virtual base classes” to any class or type (including built-in |
4096 | | -types), including other ABCs. |
4097 | | - |
4098 | | -type.__instancecheck__(self, instance) |
4099 | | - |
4100 | | - Return true if *instance* should be considered a (direct or |
4101 | | - indirect) instance of *class*. If defined, called to implement |
4102 | | - "isinstance(instance, class)". |
4103 | | - |
4104 | | -type.__subclasscheck__(self, subclass) |
4105 | | - |
4106 | | - Return true if *subclass* should be considered a (direct or |
4107 | | - indirect) subclass of *class*. If defined, called to implement |
4108 | | - "issubclass(subclass, class)". |
4109 | | - |
4110 | | -Note that these methods are looked up on the type (metaclass) of a |
4111 | | -class. They cannot be defined as class methods in the actual class. |
4112 | | -This is consistent with the lookup of special methods that are called |
4113 | | -on instances, only in this case the instance is itself a class. |
4114 | | - |
4115 | | -See also: |
4116 | | - |
4117 | | - **PEP 3119** - Introducing Abstract Base Classes |
4118 | | - Includes the specification for customizing "isinstance()" and |
4119 | | - "issubclass()" behavior through "__instancecheck__()" and |
4120 | | - "__subclasscheck__()", with motivation for this functionality in |
4121 | | - the context of adding Abstract Base Classes (see the "abc" |
4122 | | - module) to the language. |
4123 | 4086 | ''', |
4124 | 4087 | 'customization': r'''Basic customization |
4125 | 4088 | ******************* |
@@ -4429,6 +4392,43 @@ def __hash__(self): |
4429 | 4392 | considered true if its result is nonzero. If a class defines |
4430 | 4393 | neither "__len__()" nor "__bool__()" (which is true of the "object" |
4431 | 4394 | class itself), all its instances are considered true. |
| 4395 | +''', |
| 4396 | + 'customize-instance-subclass-checks': r'''Customizing instance and subclass checks |
| 4397 | +**************************************** |
| 4398 | + |
| 4399 | +The following methods are used to override the default behavior of the |
| 4400 | +"isinstance()" and "issubclass()" built-in functions. |
| 4401 | + |
| 4402 | +In particular, the metaclass "abc.ABCMeta" implements these methods in |
| 4403 | +order to allow the addition of Abstract Base Classes (ABCs) as |
| 4404 | +“virtual base classes” to any class or type (including built-in |
| 4405 | +types), including other ABCs. |
| 4406 | + |
| 4407 | +type.__instancecheck__(self, instance) |
| 4408 | + |
| 4409 | + Return true if *instance* should be considered a (direct or |
| 4410 | + indirect) instance of *class*. If defined, called to implement |
| 4411 | + "isinstance(instance, class)". |
| 4412 | + |
| 4413 | +type.__subclasscheck__(self, subclass) |
| 4414 | + |
| 4415 | + Return true if *subclass* should be considered a (direct or |
| 4416 | + indirect) subclass of *class*. If defined, called to implement |
| 4417 | + "issubclass(subclass, class)". |
| 4418 | + |
| 4419 | +Note that these methods are looked up on the type (metaclass) of a |
| 4420 | +class. They cannot be defined as class methods in the actual class. |
| 4421 | +This is consistent with the lookup of special methods that are called |
| 4422 | +on instances, only in this case the instance is itself a class. |
| 4423 | + |
| 4424 | +See also: |
| 4425 | + |
| 4426 | + **PEP 3119** - Introducing Abstract Base Classes |
| 4427 | + Includes the specification for customizing "isinstance()" and |
| 4428 | + "issubclass()" behavior through "__instancecheck__()" and |
| 4429 | + "__subclasscheck__()", with motivation for this functionality in |
| 4430 | + the context of adding Abstract Base Classes (see the "abc" |
| 4431 | + module) to the language. |
4432 | 4432 | ''', |
4433 | 4433 | 'debugger': r'''"pdb" — The Python Debugger |
4434 | 4434 | *************************** |
|
0 commit comments