chunk_id
large_stringlengths
36
36
doc_type
large_stringclasses
2 values
category
large_stringclasses
17 values
document
large_stringclasses
50 values
version_raw
large_stringclasses
590 values
chunk_index
int64
0
262
text
large_stringlengths
11
5.69k
file_path
large_stringclasses
882 values
edfa6266-66a3-5e2d-a0e1-63a42173c0f4
docs
python
python_datamodel
312
4
part of a container’s value. In most cases, when we talk about the value of a container, we imply the values, not the identities of the contained objects; however, when we talk about the mutability of a container, only the identities of the immediately contained objects are implied. So, if an immutable container (like ...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
a062c43a-8168-50af-b047-e4971c04e692
docs
python
python_datamodel
312
5
can be reused. This behaviour depends on the implementation used, so should not be relied upon, but is something to be aware of when making use of object identity tests. However, after `c = []; d = []`, *c* and *d* are guaranteed to refer to two different, unique, newly created empty lists. (Note that `e = f = []` assi...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
af3d24a6-c4a6-5d32-88a5-d8994e15449a
docs
python
python_datamodel
312
6
are not intended for general use. Their definition may change in the future. ### 3.2.1. None[¶](#none "Link to this heading") This type has a single value. There is a single object with this value. This object is accessed through the built-in name `None`. It is used to signify the absence of a value in many situation...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
80396300-becb-56b9-b026-0fbaefddd059
docs
python
python_datamodel
312
7
[Implementing the arithmetic operations](../library/numbers.html#implementing-the-arithmetic-operations) for more details. Changed in version 3.9: Evaluating [`NotImplemented`](../library/constants.html#NotImplemented "NotImplemented") in a boolean context is deprecated. While it currently evaluates as true, it will e...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
a60d60c6-773e-5afa-81b9-f1d4d1df2c74
docs
python
python_datamodel
312
8
operators and arithmetic built-in functions. Numeric objects are immutable; once created their value never changes. Python numbers are of course strongly related to mathematical numbers, but subject to the limitations of numerical representation in computers. The string representations of the numeric classes, computed...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
0c433a13-c3e4-5d8c-a9b2-cec7520076f4
docs
python
python_datamodel
312
9
#### 3.2.4.1. [`numbers.Integral`](../library/numbers.html#numbers.Integral "numbers.Integral")[¶](#numbers-integral "Link to this heading") These represent elements from the mathematical set of integers (positive and negative). Note The rules for integer representation are intended to give the most meaningful inter...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
1349e9d4-35e0-511b-ae04-f4a8aff1de9d
docs
python
python_datamodel
312
10
the values `False` and `True` are the only Boolean objects. The Boolean type is a subtype of the integer type, and Boolean values behave like the values 0 and 1, respectively, in almost all contexts, the exception being that when converted to a string, the strings `"False"` or `"True"` are returned, res...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
e0775538-9b0e-5c3b-bbfe-480e98be5d72
docs
python
python_datamodel
312
11
language with two kinds of floating-point numbers. #### 3.2.4.3. [`numbers.Complex`](../library/numbers.html#numbers.Complex "numbers.Complex") ([`complex`](../library/functions.html#complex "complex"))[¶](#numbers-complex-complex "Link to this heading") These represent complex numbers as a pair of machine-level doub...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
1bcf994d-f7fb-5147-8f49-aa618c49dcfd
docs
python
python_datamodel
312
12
sequence length. For example, `a[-2]` equals `a[n-2]`, the second to last item of sequence a with length `n`. Sequences also support slicing: `a[i:j]` selects all items with index *k* such that *i* `<=` *k* `<` *j*. When used as an expression, a slice is a sequence of the same type. The comment above about negative in...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
6eaa2a63-dcaf-5ac5-b2f1-64de2bc19803
docs
python
python_datamodel
312
13
Strings : A string is a sequence of values that represent Unicode code points. All the code points in the range `U+0000 - U+10FFFF` can be represented in a string. Python doesn’t have a char type; instead, every code point in the string is represented as a string object with length `1`. The built-in f...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
ad07049e-21e0-5b48-8321-0cb0815cb7c4
docs
python
python_datamodel
312
14
: The items of a tuple are arbitrary Python objects. Tuples of two or more items are formed by comma-separated lists of expressions. A tuple of one item (a ‘singleton’) can be formed by affixing a comma to an expression (an expression by itself does not create a tuple, since parentheses must be usable...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
7f3e5b9b-a205-5776-b5ee-2728dc803cb4
docs
python
python_datamodel
312
15
#### 3.2.5.2. Mutable sequences[¶](#mutable-sequences "Link to this heading") Mutable sequences can be changed after they are created. The subscription and slicing notations can be used as the target of assignment and [`del`](simple_stmts.html#del) (delete) statements. Note The [`collections`](../library/collections...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
93620e1f-03c5-5719-92ac-ec8bddcfa3b7
docs
python
python_datamodel
312
16
[`bytearray()`](../library/stdtypes.html#bytearray "bytearray") constructor. Aside from being mutable (and hence unhashable), byte arrays otherwise provide the same interface and functionality as immutable [`bytes`](../library/stdtypes.html#bytes "bytes") objects. ### 3.2.6. Set types[¶](#set-types "Link t...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
09409ffb-35d5-5184-b9de-63cf5569e982
docs
python
python_datamodel
312
17
compare equal (e.g., `1` and `1.0`), only one of them can be contained in a set. There are currently two intrinsic set types: Sets : These represent a mutable set. They are created by the built-in [`set()`](../library/stdtypes.html#set "set") constructor and can be modified afterwards by several methods, such a...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
c028e97f-ee3e-5d0e-99af-e9ff555dd0c4
docs
python
python_datamodel
312
18
[`del`](simple_stmts.html#del) statements. The built-in function [`len()`](../library/functions.html#len "len") returns the number of items in a mapping. There is currently a single intrinsic mapping type: #### 3.2.7.1. Dictionaries[¶](#dictionaries "Link to this heading") These represent finite sets of objects inde...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
cd51ac28-ccc9-539a-9180-f892862ae507
docs
python
python_datamodel
312
19
Replacing an existing key does not change the order, however removing a key and re-inserting it will add it to the end instead of keeping its old place. Dictionaries are mutable; they can be created by the `{}` notation (see section [Dictionary displays](expressions.html#dict)). The extension modules [`dbm.ndbm`](../...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
f8e10e63-d712-5f5e-a600-73ab72098082
docs
python
python_datamodel
312
20
### 3.2.8. Callable types[¶](#callable-types "Link to this heading") These are the types to which the function call operation (see section [Calls](expressions.html#calls)) can be applied: #### 3.2.8.1. User-defined functions[¶](#user-defined-functions "Link to this heading") A user-defined function object is created...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
1fd5f14c-abf5-597e-bb84-9129660ce7b6
docs
python
python_datamodel
312
21
| function.\_\_closure\_\_[¶](#function.__closure__ "Link to this definition") | `None` or a [`tuple`](../library/stdtypes.html#tuple "tuple") of cells that contain bindings for the function’s free variables. A cell object has the attribute `cell_contents`. This can be used to get the value of the cell, as well as set...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
7cfacf00-a00c-5cea-b5a5-a47f449539d0
docs
python
python_datamodel
312
22
| function.\_\_qualname\_\_[¶](#function.__qualname__ "Link to this definition") | The function’s [qualified name](../glossary.html#term-qualified-name). See also: [`__qualname__ attributes`](../library/stdtypes.html#definition.__qualname__ "definition.__qualname__"). Added in version 3.3. | | function.\_\_module\_\_[...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
10d8a9ad-c8f9-56c6-9a91-380b79247669
docs
python
python_datamodel
312
23
| function.\_\_dict\_\_[¶](#function.__dict__ "Link to this definition") | The namespace supporting arbitrary function attributes. See also: [`__dict__ attributes`](#object.__dict__ "object.__dict__"). | | function.\_\_annotations\_\_[¶](#function.__annotations__ "Link to this definition") | A [`dictionary`](../library...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
11f5799d-0cad-5305-80a2-8eee3dbbad8e
docs
python
python_datamodel
312
24
| function.\_\_type\_params\_\_[¶](#function.__type_params__ "Link to this definition") | A [`tuple`](../library/stdtypes.html#tuple "tuple") containing the [type parameters](compound_stmts.html#type-params) of a [generic function](compound_stmts.html#generic-functions). Added in version 3.12. | Function objects also...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
44d2c1b8-61a6-5e2d-ba04-3d89bbabc001
docs
python
python_datamodel
312
25
#### 3.2.8.2. Instance methods[¶](#instance-methods "Link to this heading") An instance method object combines a class, a class instance and any callable object (normally a user-defined function). Special read-only attributes: | | | | --- | --- | | method.\_\_self\_\_[¶](#method.__self__ "Link to this definition")...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
9ab839c0-f1f5-5659-ba67-ef280b57be74
docs
python
python_datamodel
312
26
| method.\_\_module\_\_[¶](#method.__module__ "Link to this definition") | The name of the module the method was defined in, or `None` if unavailable. | Methods also support accessing (but not setting) the arbitrary function attributes on the underlying [function object](#user-defined-funcs). User-defined method obje...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
fc127316-a2dc-560c-8706-083a5d49b8ea
docs
python
python_datamodel
312
27
When an instance method object is created by retrieving a [`classmethod`](../library/functions.html#classmethod "classmethod") object from a class or instance, its [`__self__`](#method.__self__ "method.__self__") attribute is the class itself, and its [`__func__`](#method.__func__ "method.__func__") attribute is the fu...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
4bfdee37-787b-5089-b9bc-9b3f36edf9ae
docs
python
python_datamodel
312
28
itself, so that calling either `x.f(1)` or `C.f(1)` is equivalent to calling `f(C,1)` where `f` is the underlying function. It is important to note that user-defined functions which are attributes of a class instance are not converted to bound methods; this *only* happens when the function is an attribute of the class...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
b1abc0c0-139c-5743-896c-576238a3b3f1
docs
python
python_datamodel
312
29
function executes a [`return`](simple_stmts.html#return) statement or falls off the end, a [`StopIteration`](../library/exceptions.html#StopIteration "StopIteration") exception is raised and the iterator will have reached the end of the set of values to be returned. #### 3.2.8.4. Coroutine functions[¶](#coroutine-func...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
2b9fcc0c-fb7f-5e1d-ab86-03692459343c
docs
python
python_datamodel
312
30
#### 3.2.8.5. Asynchronous generator functions[¶](#asynchronous-generator-functions "Link to this heading") A function or method which is defined using [`async def`](compound_stmts.html#async-def) and which uses the [`yield`](simple_stmts.html#yield) statement is called a *asynchronous generator function*. Such a func...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
bf076e78-ac5b-5cea-89a7-99c188092964
docs
python
python_datamodel
312
31
statement or falls off the end, a [`StopAsyncIteration`](../library/exceptions.html#StopAsyncIteration "StopAsyncIteration") exception is raised and the asynchronous iterator will have reached the end of the set of values to be yielded. #### 3.2.8.6. Built-in functions[¶](#built-in-functions "Link to this heading") A...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
9cea2558-6c66-5fd3-a895-c715843db401
docs
python
python_datamodel
312
32
* `__self__` is set to `None` (but see the next item). * `__module__` is the name of the module the function was defined in or `None` if unavailable. See [`function.__module__`](#function.__module__ "function.__module__"). #### 3.2.8.7. Built-in methods[¶](#built-in-methods "Link to this heading") This is really ...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
bb246690-7698-5998-a439-cdc26b806a30
docs
python
python_datamodel
312
33
override [`__new__()`](#object.__new__ "object.__new__"). The arguments of the call are passed to `__new__()` and, in the typical case, to [`__init__()`](#object.__init__ "object.__init__") to initialize the new instance. #### 3.2.8.9. Class Instances[¶](#class-instances "Link to this heading") Instances of arbitrary...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
8981a180-186d-5a96-8ede-012fdfa4e92d
docs
python
python_datamodel
312
34
[`dictionary`](../library/stdtypes.html#dict "dict") object (this is the dictionary referenced by the [`__globals__`](#function.__globals__ "function.__globals__") attribute of functions defined in the module). Attribute references are translated to lookups in this dictionary, e.g., `m.x` is equivalent to `m.__dict__["...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
6b04ea34-a586-5615-a42f-4dda014fd973
docs
python
python_datamodel
312
35
[spec](../glossary.html#term-module-spec), before the [loader](../glossary.html#term-loader) executes and loads the module. To create a module dynamically rather than using the import system, it’s recommended to use [`importlib.util.module_from_spec()`](../library/importlib.html#importlib.util.module_from_spec "import...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
f0e2e920-cf9f-5afb-8006-276482e1cfdd
docs
python
python_datamodel
312
36
Note that updating an attribute on `__spec__` will not update the corresponding attribute on the module itself: ```None >>> import typing >>> typing.__name__, typing.__spec__.name ('typing', 'typing') >>> typing.__spec__.name = 'spelling' >>> typing.__name__, typing.__spec__.name ('typing', 'spelling') >>> typing.__na...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
b8f7651a-3afc-5bb9-b7fe-a44b020e452a
docs
python
python_datamodel
312
37
Set to the [`module spec`](../library/importlib.html#importlib.machinery.ModuleSpec "importlib.machinery.ModuleSpec") that was used when importing the module. See [Module specs](import.html#module-specs) for more details. Added in version 3.4. module.\_\_package\_\_[¶](#module.__package__ "Link to this de...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
5ef57848-3630-5efe-aa04-1fc253e19ab0
docs
python
python_datamodel
312
38
modules created dynamically using the [`types.ModuleType`](../library/types.html#types.ModuleType "types.ModuleType") constructor; use [`importlib.util.module_from_spec()`](../library/importlib.html#importlib.util.module_from_spec "importlib.util.module_from_spec") instead to ensure the attribute is set to ...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
3df6b6df-2216-5cb9-84f6-769d679f5b0f
docs
python
python_datamodel
312
39
Changed in version 3.6: The value of `__package__` is expected to be the same as [`__spec__.parent`](../library/importlib.html#importlib.machinery.ModuleSpec.parent "importlib.machinery.ModuleSpec.parent"). [`__package__`](#module.__package__ "module.__package__") is now only used as a fallback during impor...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
64861ce7-5666-5ea3-b0ab-2bfb24f814cf
docs
python
python_datamodel
312
40
module.\_\_loader\_\_[¶](#module.__loader__ "Link to this definition") : The [loader](../glossary.html#term-loader) object that the import machinery used to load the module. This attribute is mostly useful for introspection, but can be used for additional loader-specific functionality, for example getting da...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
ee767f58-31cc-53a2-8a3b-cfa85d33a90a
docs
python
python_datamodel
312
41
Changed in version 3.4: This attribute now defaults to `None` for modules created dynamically using the [`types.ModuleType`](../library/types.html#types.ModuleType "types.ModuleType") constructor. Previously the attribute was optional. Deprecated since version 3.12, will be removed in version 3.16: Set...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
b8dfbf32-2498-5d50-ace6-f7da3672144c
docs
python
python_datamodel
312
42
[`module.__spec__.submodule_search_locations`](../library/importlib.html#importlib.machinery.ModuleSpec.submodule_search_locations "importlib.machinery.ModuleSpec.submodule_search_locations") instead of `module.__path__`. module.\_\_file\_\_[¶](#module.__file__ "Link to this definition") module.\_\_cached\_\_...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
09a0d13f-18ad-5f05-8d9e-060f19cd4ace
docs
python
python_datamodel
312
43
has no semantic meaning (for example, a module loaded from a database). If `__file__` is set then the `__cached__` attribute might also be set, which is the path to any compiled version of the code (for example, a byte-compiled file). The file does not need to exist to set this attribute; the path ...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
3f98105b-cc0d-5608-b9c3-51e22e0539b7
docs
python
python_datamodel
312
44
[`module.__spec__.cached`](../library/importlib.html#importlib.machinery.ModuleSpec.cached "importlib.machinery.ModuleSpec.cached") instead of `module.__cached__`. #### 3.2.9.2. Other writable attributes on module objects[¶](#other-writable-attributes-on-module-objects "Link to this heading") As well as the i...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
66053469-81b3-5da2-a97a-b331ae66063e
docs
python
python_datamodel
312
45
please see [Annotations Best Practices](../howto/annotations.html#annotations-howto). #### 3.2.9.3. Module dictionaries[¶](#module-dictionaries "Link to this heading") Module objects also have the following special read-only attribute: module.\_\_dict\_\_[¶](#module.__dict__ "Link to this definition") : The mo...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
d9c32604-4dc7-5744-a3b8-cfd79dd92268
docs
python
python_datamodel
312
46
### 3.2.10. Custom classes[¶](#custom-classes "Link to this heading") Custom class types are typically created by class definitions (see section [Class definitions](compound_stmts.html#class)). A class has a namespace implemented by a dictionary object. Class attribute references are translated to lookups in this dict...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
e0487756-a7f2-541d-bfbf-79f07366770f
docs
python
python_datamodel
312
47
class method object, it is transformed into an instance method object whose [`__self__`](#method.__self__ "method.__self__") attribute is `C`. When it would yield a [`staticmethod`](../library/functions.html#staticmethod "staticmethod") object, it is transformed into the object wrapped by the static method object. See ...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
727d0dd6-daba-5ec9-9aee-ca48225d18be
docs
python
python_datamodel
312
48
| type.\_\_qualname\_\_[¶](#type.__qualname__ "Link to this definition") | The class’s [qualified name](../glossary.html#term-qualified-name). See also: [`__qualname__ attributes`](../library/stdtypes.html#definition.__qualname__ "definition.__qualname__"). | | type.\_\_module\_\_[¶](#type.__module__ "Link to this defi...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
3bdabaf9-6893-5ff1-b18d-1a294e2d2257
docs
python
python_datamodel
312
49
| type.\_\_doc\_\_[¶](#type.__doc__ "Link to this definition") | The class’s documentation string, or `None` if undefined. Not inherited by subclasses. | | type.\_\_annotations\_\_[¶](#type.__annotations__ "Link to this definition") | A dictionary containing [variable annotations](../glossary.html#term-variable-annotat...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
c711d030-6813-56e7-a736-f8c77e70ec4b
docs
python
python_datamodel
312
50
| type.\_\_type\_params\_\_[¶](#type.__type_params__ "Link to this definition") | A [`tuple`](../library/stdtypes.html#tuple "tuple") containing the [type parameters](compound_stmts.html#type-params) of a [generic class](compound_stmts.html#generic-classes). Added in version 3.12. | | type.\_\_mro\_\_[¶](#type.__mro__...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
86070025-9cf2-548a-b433-52f1e15687f7
docs
python
python_datamodel
312
51
type.\_\_subclasses\_\_()[¶](#type.__subclasses__ "Link to this definition") : Each class keeps a list of weak references to its immediate subclasses. This method returns a list of all those references still alive. The list is in definition order. Example: ```None >>> class A: pass >>> class B(A)...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
be9d12fa-b1f2-5b0f-aa8a-ee766a20fc1e
docs
python
python_datamodel
312
52
class method objects are also transformed; see above under “Classes”. See section [Implementing Descriptors](#descriptors) for another way in which attributes of a class retrieved via its instances may differ from the objects actually stored in the class’s [`__dict__`](#object.__dict__ "object.__dict__"). If no class a...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
a5824f61-9a0e-53ac-b608-562fe20ae7c3
docs
python
python_datamodel
312
53
#### 3.2.11.1. Special attributes[¶](#id4 "Link to this heading") object.\_\_class\_\_[¶](#object.__class__ "Link to this definition") : The class to which a class instance belongs. object.\_\_dict\_\_[¶](#object.__dict__ "Link to this definition") : A dictionary or other mapping object used to store an object’s ...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
35a9f3a5-9b23-591b-a6db-0ec971dcde15
docs
python
python_datamodel
312
54
[`makefile()`](../library/socket.html#socket.socket.makefile "socket.socket.makefile") method of socket objects (and perhaps by other functions or methods provided by extension modules). The objects `sys.stdin`, `sys.stdout` and `sys.stderr` are initialized to file objects corresponding to the interpreter’s standard i...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
6e67f09c-d59f-541e-b8da-4a9465732a05
docs
python
python_datamodel
312
55
The difference between a code object and a function object is that the function object contains an explicit reference to the function’s globals (the module in which it was defined), while a code object contains no context; also the default argument values are stored in the function object, not in the code object (becau...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
43e77266-74fe-5703-aefe-83a6401230dd
docs
python
python_datamodel
312
56
| codeobject.co\_argcount[¶](#codeobject.co_argcount "Link to this definition") | The total number of positional [parameters](../glossary.html#term-parameter) (including positional-only parameters and parameters with default values) that the function has | | codeobject.co\_posonlyargcount[¶](#codeobject.co_posonlyargco...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
c0609b88-349a-583e-b679-1251f16f9afe
docs
python
python_datamodel
312
57
| codeobject.co\_varnames[¶](#codeobject.co_varnames "Link to this definition") | A [`tuple`](../library/stdtypes.html#tuple "tuple") containing the names of the local variables in the function (starting with the parameter names) | | codeobject.co\_cellvars[¶](#codeobject.co_cellvars "Link to this definition") | A [`tu...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
fcb0016f-227e-5925-9061-4a0a5806432b
docs
python
python_datamodel
312
58
| codeobject.co\_consts[¶](#codeobject.co_consts "Link to this definition") | A [`tuple`](../library/stdtypes.html#tuple "tuple") containing the literals used by the [bytecode](../glossary.html#term-bytecode) in the function | | codeobject.co\_names[¶](#codeobject.co_names "Link to this definition") | A [`tuple`](../li...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
706d3178-cc9e-5e33-b911-1224e2d1bf60
docs
python
python_datamodel
312
59
| codeobject.co\_lnotab[¶](#codeobject.co_lnotab "Link to this definition") | A string encoding the mapping from [bytecode](../glossary.html#term-bytecode) offsets to line numbers. For details, see the source code of the interpreter. Deprecated since version 3.12: This attribute of code objects is deprecated, and may ...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
5f9a4265-cdb9-54f0-b666-9bfce59e9145
docs
python
python_datamodel
312
60
if the function is a generator. See [Code Objects Bit Flags](../library/inspect.html#inspect-module-co-flags) for details on the semantics of each flags that might be present. Future feature declarations (`from __future__ import division`) also use bits in [`co_flags`](#codeobject.co_flags "codeobject.co_flags") to in...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
5be9efc7-5720-5e5f-af5d-a8564fffb1df
docs
python
python_datamodel
312
61
##### 3.2.13.1.2. Methods on code objects[¶](#methods-on-code-objects "Link to this heading") codeobject.co\_positions()[¶](#codeobject.co_positions "Link to this definition") : Returns an iterable over the source code positions of each [bytecode](../glossary.html#term-bytecode) instruction in the code object. ...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
a8d812d2-e1b1-5019-9cd1-7cf715f71b0f
docs
python
python_datamodel
312
62
* Position tuples corresponding to artificial instructions. * Line and column numbers that can’t be represented due to implementation specific limitations. When this occurs, some or all of the tuple elements can be [`None`](../library/constants.html#None "None"). Added in version 3.11. ...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
f77127cb-02f7-5929-a350-cef3a34d0b1b
docs
python
python_datamodel
312
63
[bytecode](../glossary.html#term-bytecode)s. Each item yielded is a `(start, end, lineno)` [`tuple`](../library/stdtypes.html#tuple "tuple"): * `start` (an [`int`](../library/functions.html#int "int")) represents the offset (inclusive) of the start of the [bytecode](../glossary.html#term-bytecode) ra...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
246cc5d6-7ee1-5cc0-976b-6f359d391e96
docs
python
python_datamodel
312
64
is, for any pair of [`tuple`](../library/stdtypes.html#tuple "tuple")s, the `start` of the second will be equal to the `end` of the first. * No range will be backwards: `end >= start` for all triples. * The last [`tuple`](../library/stdtypes.html#tuple "tuple") yielded will have `end` equal to the s...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
c14f403d-71f0-5a4f-b605-863a9af466fc
docs
python
python_datamodel
312
65
#### 3.2.13.2. Frame objects[¶](#frame-objects "Link to this heading") Frame objects represent execution frames. They may occur in [traceback objects](#traceback-objects), and are also passed to registered trace functions. ##### 3.2.13.2.1. Special read-only attributes[¶](#index-66 "Link to this heading") | | | | ...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
036e4a58-71f0-5311-beee-da2e63bb607b
docs
python
python_datamodel
312
66
| frame.f\_globals[¶](#frame.f_globals "Link to this definition") | The dictionary used by the frame to look up [global variables](executionmodel.html#naming) | | frame.f\_builtins[¶](#frame.f_builtins "Link to this definition") | The dictionary used by the frame to look up [built-in (intrinsic) names](executionmodel.h...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
968ae7e1-7981-5d72-9c5e-068503cabe23
docs
python
python_datamodel
312
67
| frame.f\_trace\_lines[¶](#frame.f_trace_lines "Link to this definition") | Set this attribute to [`False`](../library/constants.html#False "False") to disable triggering a tracing event for each source line. | | frame.f\_trace\_opcodes[¶](#frame.f_trace_opcodes "Link to this definition") | Set this attribute to [`Tru...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
b50ebd35-579d-57ae-b3f7-f767727eacc1
docs
python
python_datamodel
312
68
##### 3.2.13.2.3. Frame object methods[¶](#frame-object-methods "Link to this heading") Frame objects support one method: frame.clear()[¶](#frame.clear "Link to this definition") : This method clears all references to [local variables](executionmodel.html#naming) held by the frame. Also, if the frame belonged t...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
4dc3e358-a632-5bb8-892a-9c211986150a
docs
python
python_datamodel
312
69
is implicitly created when an exception occurs, and may also be explicitly created by calling [`types.TracebackType`](../library/types.html#types.TracebackType "types.TracebackType"). Changed in version 3.7: Traceback objects can now be explicitly instantiated from Python code. For implicitly created tracebacks, when...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
d0fd89ef-c024-504a-bccd-840343c24c76
docs
python
python_datamodel
312
70
stream; if the interpreter is interactive, it is also made available to the user as [`sys.last_traceback`](../library/sys.html#sys.last_traceback "sys.last_traceback"). For explicitly created tracebacks, it is up to the creator of the traceback to determine how the [`tb_next`](#traceback.tb_next "traceback.tb_next") a...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
f9846b64-bb05-5f5a-acda-54654a7452b4
docs
python
python_datamodel
312
71
The line number and last instruction in the traceback may differ from the line number of its [frame object](#frame-objects) if the exception occurred in a [`try`](compound_stmts.html#try) statement with no matching except clause or with a [`finally`](compound_stmts.html#finally) clause. traceback.tb\_next[¶](#tracebac...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
bf3540e3-27fc-55ae-b47c-fb922fa903b1
docs
python
python_datamodel
312
72
[`stop`](../library/functions.html#slice.stop "slice.stop") is the upper bound; [`step`](../library/functions.html#slice.step "slice.step") is the step value; each is `None` if omitted. These attributes can have any type. Slice objects support one method: slice.indices(*self*, *length*)[¶](#slice.indices "Link to thi...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
d9f1ef9e-f96a-5519-aa14-4af4725dffde
docs
python
python_datamodel
312
73
around any other object, usually a user-defined method object. When a static method object is retrieved from a class or a class instance, the object actually returned is the wrapped object, which is not subject to any further transformation. Static method objects are also callable. Static method objects are created by ...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
bafe2ec8-a9f7-56d8-a63e-91c530f57295
docs
python
python_datamodel
312
74
## 3.3. Special method names[¶](#special-method-names "Link to this heading") A class can implement certain operations that are invoked by special syntax (such as arithmetic operations or subscripting and slicing) by defining methods with special names. This is Python’s approach to *operator overloading*, allowing cla...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
4c70adff-6f67-5a2b-9768-317c1e22860b
docs
python
python_datamodel
312
75
[`__iter__()`](#object.__iter__ "object.__iter__") to `None`, the class is not iterable, so calling [`iter()`](../library/functions.html#iter "iter") on its instances will raise a [`TypeError`](../library/exceptions.html#TypeError "TypeError") (without falling back to [`__getitem__()`](#object.__getitem__ "object.__get...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
458bc46b-a828-50a9-8e3b-d1c6a9990873
docs
python
python_datamodel
312
76
method (special-cased so you need not declare it as such) that takes the class of which an instance was requested as its first argument. The remaining arguments are those passed to the object constructor expression (the call to the class). The return value of [`__new__()`](#object.__new__ "object.__new_...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
a670e621-7120-513d-bba5-c825a52e0c3e
docs
python
python_datamodel
312
77
and the remaining arguments are the same as were passed to the object constructor. If [`__new__()`](#object.__new__ "object.__new__") does not return an instance of *cls*, then the new instance’s [`__init__()`](#object.__init__ "object.__init__") method will not be invoked. [`__new__()`](#object.__new...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
e49732a1-bd7d-5266-ab9f-899f7734cce7
docs
python
python_datamodel
312
78
method, the derived class’s [`__init__()`](#object.__init__ "object.__init__") method, if any, must explicitly call it to ensure proper initialization of the base class part of the instance; for example: `super().__init__([args...])`. Because [`__new__()`](#object.__new__ "object.__new__") and [`__init...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
e24959c4-f74a-50ae-afa1-e7286feb6a87
docs
python
python_datamodel
312
79
[`__del__()`](#object.__del__ "object.__del__") method, the derived class’s [`__del__()`](#object.__del__ "object.__del__") method, if any, must explicitly call it to ensure proper deletion of the base class part of the instance. It is possible (though not recommended!) for the [`__del__()`](#object.__...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
6c62c4d6-b250-5f13-ab7b-eb268f56428b
docs
python
python_datamodel
312
80
a cleanup function to be called when an object is garbage collected. Note `del x` doesn’t directly call `x.__del__()` — the former decrements the reference count for `x` by one, and the latter is only called when `x`’s reference count reaches zero. **CPython implementation detail:** It is pos...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
447f488f-838f-5035-ae46-ec9838e41bb7
docs
python
python_datamodel
312
81
Due to the precarious circumstances under which [`__del__()`](#object.__del__ "object.__del__") methods are invoked, exceptions that occur during their execution are ignored, and a warning is printed to `sys.stderr` instead. In particular: * [`__del__()`](#object.__del__ "object.__del__") can be invoke...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
c8b60e11-c538-5468-b8c8-48b1584eac03
docs
python
python_datamodel
312
82
are deleted from their module before other globals are deleted; if no other references to such globals exist, this may help in assuring that imported modules are still available at the time when the [`__del__()`](#object.__del__ "object.__del__") method is called. object.\_\_repr\_\_(*self*)[¶]...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
e38bb64b-933d-568a-acdd-73d9e5e889ab
docs
python
python_datamodel
312
83
but not [`__str__()`](#object.__str__ "object.__str__"), then [`__repr__()`](#object.__repr__ "object.__repr__") is also used when an “informal” string representation of instances of that class is required. This is typically used for debugging, so it is important that the representation is information-...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
b9a637dc-5d71-5afb-abfe-4cecacad963c
docs
python
python_datamodel
312
84
This method differs from [`object.__repr__()`](#object.__repr__ "object.__repr__") in that there is no expectation that [`__str__()`](#object.__str__ "object.__str__") return a valid Python expression: a more convenient or concise representation can be used. The default implementation defined by the bu...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
65d9ad4f-a1e0-55a5-be4e-32860e3fb1e3
docs
python
python_datamodel
312
85
and by extension, evaluation of [formatted string literals](lexical_analysis.html#f-strings) and the [`str.format()`](../library/stdtypes.html#str.format "str.format") method, to produce a “formatted” string representation of an object. The *format\_spec* argument is a string that contains a description of ...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
4db7a78d-6526-51ac-803d-8ea51faad28b
docs
python
python_datamodel
312
86
an empty *format\_spec* string. It delegates to [`__str__()`](#object.__str__ "object.__str__"). Changed in version 3.4: The \_\_format\_\_ method of `object` itself raises a [`TypeError`](../library/exceptions.html#TypeError "TypeError") if passed any non-empty string. Changed in version 3.7: `object...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
e1d9723a-fc6a-5dbf-94b8-f598aecf7272
docs
python
python_datamodel
312
87
operator symbols and method names is as follows: `x<y` calls `x.__lt__(y)`, `x<=y` calls `x.__le__(y)`, `x==y` calls `x.__eq__(y)`, `x!=y` calls `x.__ne__(y)`, `x>y` calls `x.__gt__(y)`, and `x>=y` calls `x.__ge__(y)`. A rich comparison method may return the singleton [`NotImplemented`](../library/...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
3bf29d31-6b6d-51c6-b088-66524812c347
docs
python
python_datamodel
312
88
[`NotImplemented`](../library/constants.html#NotImplemented "NotImplemented") in the case of a false comparison: `True if x is y else NotImplemented`. For [`__ne__()`](#object.__ne__ "object.__ne__"), by default it delegates to [`__eq__()`](#object.__eq__ "object.__eq__") and inverts the result unless it is...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
e8acdf38-c85b-5a8b-b54d-088b4c8d2ac6
docs
python
python_datamodel
312
89
object identity, and order comparisons raise [`TypeError`](../library/exceptions.html#TypeError "TypeError"). Each default method may generate these results directly, but may also return [`NotImplemented`](../library/constants.html#NotImplemented "NotImplemented"). See the paragraph on [`__hash__()`](#...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
cc0cd3a1-a50d-53b9-bf05-23426685965f
docs
python
python_datamodel
312
90
[`__eq__()`](#object.__eq__ "object.__eq__") and [`__ne__()`](#object.__ne__ "object.__ne__") are their own reflection. If the operands are of different types, and the right operand’s type is a direct or indirect subclass of the left operand’s type, the reflected method of the right operand has priority...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
32821033-bda3-5454-b2c0-f9b3603ecc3d
docs
python
python_datamodel
312
91
[`dict`](../library/stdtypes.html#dict "dict"). The `__hash__()` method should return an integer. The only required property is that objects which compare equal have the same hash value; it is advised to mix together the hash values of the components of the object that also play a part in comparison of ...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
81089701-a38c-57ac-9024-a640a71ea4be
docs
python
python_datamodel
312
92
to do this is with `python -c "import sys; print(sys.hash_info.width)"`. If a class does not define an [`__eq__()`](#object.__eq__ "object.__eq__") method it should not define a [`__hash__()`](#object.__hash__ "object.__hash__") operation either; if it defines [`__eq__()`](#object.__eq__ "object.__eq__...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
bd252f02-fc10-5782-8c1c-860151e8d30b
docs
python
python_datamodel
312
93
by default (inherited from the [`object`](../library/functions.html#object "object") class); with them, all objects compare unequal (except with themselves) and `x.__hash__()` returns an appropriate value such that `x == y` implies both that `x is y` and `hash(x) == hash(y)`. A class that overrides [`_...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
39c7a5e6-08d6-5c29-bb96-b8e93e59a0c9
docs
python
python_datamodel
312
94
of [`__hash__()`](#object.__hash__ "object.__hash__") from a parent class, the interpreter must be told this explicitly by setting `__hash__ = <ParentClass>.__hash__`. If a class that does not override [`__eq__()`](#object.__eq__ "object.__eq__") wishes to suppress hash support, it should include `__ha...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
0d40ad3c-0dac-51a8-8827-5a294035a351
docs
python
python_datamodel
312
95
This is intended to provide protection against a denial-of-service caused by carefully chosen inputs that exploit the worst case performance of a dict insertion, *O*(*n*2) complexity. See <http://ocert.org/advisories/ocert-2011-003.html> for details. Changing hash values affects the iteration order...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
6f6f2899-25c7-5ae7-b349-2ccf2f590ea2
docs
python
python_datamodel
312
96
`__len__()` nor `__bool__()` (which is true of the [`object`](../library/functions.html#object "object") class itself), all its instances are considered true. ### 3.3.2. Customizing attribute access[¶](#customizing-attribute-access "Link to this heading") The following methods can be defined to customize the ...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
86d81ade-68a1-51b5-842b-edb3ffcb7cd5
docs
python
python_datamodel
312
97
[`AttributeError`](../library/exceptions.html#AttributeError "AttributeError")). This method should either return the (computed) attribute value or raise an [`AttributeError`](../library/exceptions.html#AttributeError "AttributeError") exception. The [`object`](../library/functions.html#object "object") cla...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
082be45c-4584-5598-8aa7-12450fa36a3f
docs
python
python_datamodel
312
98
dictionary (but instead inserting them in another object). See the [`__getattribute__()`](#object.__getattribute__ "object.__getattribute__") method below for a way to actually get total control over attribute access. object.\_\_getattribute\_\_(*self*, *name*)[¶](#object.__getattribute__ "Link to this def...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
b0c438cc-8b19-5e90-ae20-b302afda706c
docs
python
python_datamodel
312
99
method with the same name to access any attributes it needs, for example, `object.__getattribute__(self, name)`. Note This method may still be bypassed when looking up special methods as the result of implicit invocation via language syntax or [built-in functions](#builtin-functions). See ...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
999f6b2e-73bd-5e7c-93e2-181e2b9855e6
docs
python
python_datamodel
312
100
call the base class method with the same name, for example, `object.__setattr__(self, name, value)`. For certain sensitive attribute assignments, raises an [auditing event](../library/sys.html#auditing) `object.__setattr__` with arguments `obj`, `name`, `value`. object.\_\_delattr\_\_(*self*, *nam...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
63aae77f-4362-50d2-afd5-91fc50019715
docs
python
python_datamodel
312
101
returned. [`dir()`](../library/functions.html#dir "dir") converts the returned iterable to a list and sorts it. #### 3.3.2.1. Customizing module attribute access[¶](#customizing-module-attribute-access "Link to this heading") Special names `__getattr__` and `__dir__` can be also used to customize access to module...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
1e565abf-b513-5519-913f-f6192d37b26e
docs
python
python_datamodel
312
102
The `__dir__` function should accept no arguments, and return an iterable of strings that represents the names accessible on module. If present, this function overrides the standard [`dir()`](../library/functions.html#dir "dir") search on a module. For a more fine grained customization of the module behavior (setting ...
large_dataset/raw/docs/python/datamodel/datamodel_312.md
cd8f7ea6-7a71-5283-8004-32d13ed0282d
docs
python
python_datamodel
312
103
the module globals (whether by code within the module, or via a reference to the module’s globals dictionary) is unaffected. Changed in version 3.5: `__class__` module attribute is now writable. Added in version 3.7: `__getattr__` and `__dir__` module attributes. See also [**PEP 562**](https://peps.python.org/pep-0...
large_dataset/raw/docs/python/datamodel/datamodel_312.md