chunk_id stringlengths 36 36 | source stringclasses 35
values | source_url stringlengths 0 290 | upstream_license stringclasses 1
value | document_id stringlengths 36 36 | chunk_index int64 0 324k | retrieved_at stringclasses 2
values | chunker_version stringclasses 4
values | content_hash stringlengths 15 64 | content stringlengths 50 44.7k | namespace stringclasses 9
values | source_name stringclasses 35
values | raw_text stringlengths 50 44.7k | cleaned_text stringlengths 50 44.7k | tags stringclasses 49
values | collection_name stringclasses 11
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8442af8e-7b0c-4608-87c9-dab3901eeeb0 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,767 | supabase-export-v2 | 26880c8c12d28a73 | .. index:: pair: object; set
A :dfn:`set` object is an unordered collection of distinct :term:`hashable` objects. Common uses include membership testing, removing duplicates from a sequence, and
computing mathematical operations such as intersection, union, difference, and
symmetric difference. (For other containers se... | trusted_official_docs | CPython Docs | .. index:: pair: object; set
A :dfn:`set` object is an unordered collection of distinct :term:`hashable` objects. Common uses include membership testing, removing duplicates from a sequence, and
computing mathematical operations such as intersection, union, difference, and
symmetric difference. (For other containers se... | .. index:: pair: object; set
A :dfn:`set` object is an unordered collection of distinct :term:`hashable` objects. Common uses include membership testing, removing duplicates from a sequence, and
computing mathematical operations such as intersection, union, difference, and
symmetric difference. (For other containers se... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
847cebb4-3f9f-4317-b74b-cbe696d47192 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,946 | supabase-export-v2 | db20faf715622078 | * :meth:`!__delitem__` * :meth:`!__setitem__` * :meth:`~dict.clear` * :meth:`~dict.pop` * :meth:`~dict.popitem` * :meth:`~dict.setdefault` * :meth:`~dict.update`
* A :class:`!frozendict` can be hashed with ``hash(frozendict)`` if all keys and
values can be hashed. | trusted_official_docs | CPython Docs | * :meth:`!__delitem__` * :meth:`!__setitem__` * :meth:`~dict.clear` * :meth:`~dict.pop` * :meth:`~dict.popitem` * :meth:`~dict.setdefault` * :meth:`~dict.update`
* A :class:`!frozendict` can be hashed with ``hash(frozendict)`` if all keys and
values can be hashed. | * :meth:`!__delitem__` * :meth:`!__setitem__` * :meth:`~dict.clear` * :meth:`~dict.pop` * :meth:`~dict.popitem` * :meth:`~dict.setdefault` * :meth:`~dict.update`
* A :class:`!frozendict` can be hashed with ``hash(frozendict)`` if all keys and
values can be hashed. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
85cd5d20-38b4-4e42-a356-91c8fb687bbf | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,938 | supabase-export-v2 | 0d162502b3cf5949 | >>> # view objects are dynamic and reflect dict changes >>> del dishes['eggs'] >>> del dishes['sausage'] >>> list(keys) ['bacon', 'spam']
>>> # set operations
>>> keys & {'eggs', 'bacon', 'salad'}
{'bacon'}
>>> keys ^ {'sausage', 'juice'} == {'juice', 'sausage', 'bacon', 'spam'}
True
>>> keys | ['juice', 'juice', ... | trusted_official_docs | CPython Docs | >>> # view objects are dynamic and reflect dict changes >>> del dishes['eggs'] >>> del dishes['sausage'] >>> list(keys) ['bacon', 'spam']
>>> # set operations
>>> keys & {'eggs', 'bacon', 'salad'}
{'bacon'}
>>> keys ^ {'sausage', 'juice'} == {'juice', 'sausage', 'bacon', 'spam'}
True
>>> keys | ['juice', 'juice', ... | >>> # view objects are dynamic and reflect dict changes >>> del dishes['eggs'] >>> del dishes['sausage'] >>> list(keys) ['bacon', 'spam']
>>> # set operations
>>> keys & {'eggs', 'bacon', 'salad'}
{'bacon'}
>>> keys ^ {'sausage', 'juice'} == {'juice', 'sausage', 'bacon', 'spam'}
True
>>> keys | ['juice', 'juice', ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
87206d1d-e371-4001-a3d1-6d342a330d86 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,956 | supabase-export-v2 | d4e749bf5f323bf6 | itself is a :term:`file object`. File objects return themselves from __enter__() to allow :func:`open` to be used as the context expression in a :keyword:`with` statement.
An example of a context manager that returns a related object is the one
returned by :func:`decimal.localcontext`. These managers set the active
d... | trusted_official_docs | CPython Docs | itself is a :term:`file object`. File objects return themselves from __enter__() to allow :func:`open` to be used as the context expression in a :keyword:`with` statement.
An example of a context manager that returns a related object is the one
returned by :func:`decimal.localcontext`. These managers set the active
d... | itself is a :term:`file object`. File objects return themselves from __enter__() to allow :func:`open` to be used as the context expression in a :keyword:`with` statement.
An example of a context manager that returns a related object is the one
returned by :func:`decimal.localcontext`. These managers set the active
d... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
89cefa5e-d27d-4a00-8730-0a9b36c0a4da | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,915 | supabase-export-v2 | ef508cf3e0f769ea | Dictionary view objects -----------------------
The objects returned by :meth:`dict.keys`, :meth:`dict.values` and
:meth:`dict.items` are *view objects*. They provide a dynamic view on the
dictionary's entries, which means that when the dictionary changes, the view
reflects these changes. | trusted_official_docs | CPython Docs | Dictionary view objects -----------------------
The objects returned by :meth:`dict.keys`, :meth:`dict.values` and
:meth:`dict.items` are *view objects*. They provide a dynamic view on the
dictionary's entries, which means that when the dictionary changes, the view
reflects these changes. | Dictionary view objects -----------------------
The objects returned by :meth:`dict.keys`, :meth:`dict.values` and
:meth:`dict.items` are *view objects*. They provide a dynamic view on the
dictionary's entries, which means that when the dictionary changes, the view
reflects these changes. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8b6a7b7b-dfbf-4a8a-8044-acd2fcfdb7ab | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,894 | supabase-export-v2 | 82bb77b4f2e8b675 | .. method:: setdefault(key, default=None, /)
If *key* is in the dictionary, return its value. If not, insert *key*
with a value of *default* and return *default*. *default* defaults to
``None``. | trusted_official_docs | CPython Docs | .. method:: setdefault(key, default=None, /)
If *key* is in the dictionary, return its value. If not, insert *key*
with a value of *default* and return *default*. *default* defaults to
``None``. | .. method:: setdefault(key, default=None, /)
If *key* is in the dictionary, return its value. If not, insert *key*
with a value of *default* and return *default*. *default* defaults to
``None``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8ba10099-9303-4a12-b57c-c1d214c5f5cb | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,933 | supabase-export-v2 | 0d5a7bd607573e9a | ``<``, or ``^``). While using set operators, set-like views accept any iterable as the other operand, unlike sets which only accept sets as the input.
An example of dictionary view usage:: | trusted_official_docs | CPython Docs | ``<``, or ``^``). While using set operators, set-like views accept any iterable as the other operand, unlike sets which only accept sets as the input.
An example of dictionary view usage:: | ``<``, or ``^``). While using set operators, set-like views accept any iterable as the other operand, unlike sets which only accept sets as the input.
An example of dictionary view usage:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8c230cdc-ea86-4927-8579-6a8be6918a57 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,127 | supabase-export-v2 | 68bb41cca049fc70 | Integer string conversion length limitation ===========================================
CPython has a global limit for converting between :class:`int` and :class:`str`
to mitigate denial of service attacks. This limit *only* applies to decimal or
other non-power-of-two number bases. Hexadecimal, octal, and binary conve... | trusted_official_docs | CPython Docs | Integer string conversion length limitation ===========================================
CPython has a global limit for converting between :class:`int` and :class:`str`
to mitigate denial of service attacks. This limit *only* applies to decimal or
other non-power-of-two number bases. Hexadecimal, octal, and binary conve... | Integer string conversion length limitation ===========================================
CPython has a global limit for converting between :class:`int` and :class:`str`
to mitigate denial of service attacks. This limit *only* applies to decimal or
other non-power-of-two number bases. Hexadecimal, octal, and binary conve... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8ce43113-d051-427a-9b83-a3ad1f20ba17 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,897 | supabase-export-v2 | dcba3105806b0b7d | Update the dictionary with the key/value pairs from *mapping* or *iterable* and *kwargs*, overwriting existing keys. Return ``None``.
:meth:`update` accepts either another object with a ``keys()`` method (in
which case :meth:`~object.__getitem__` is called with every key returned from
the method) or an iterable of ke... | trusted_official_docs | CPython Docs | Update the dictionary with the key/value pairs from *mapping* or *iterable* and *kwargs*, overwriting existing keys. Return ``None``.
:meth:`update` accepts either another object with a ``keys()`` method (in
which case :meth:`~object.__getitem__` is called with every key returned from
the method) or an iterable of ke... | Update the dictionary with the key/value pairs from *mapping* or *iterable* and *kwargs*, overwriting existing keys. Return ``None``.
:meth:`update` accepts either another object with a ``keys()`` method (in
which case :meth:`~object.__getitem__` is called with every key returned from
the method) or an iterable of ke... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8d5e654d-368c-40db-8e27-1e15a319e1dd | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,050 | supabase-export-v2 | ba58203141b1a721 | .. doctest::
>>> class M(type):
... def __or__(self, other):
... return "Hello"
... >>> class C(metaclass=M):
... pass
... >>> C | int
'Hello'
>>> int | C
int | C | trusted_official_docs | CPython Docs | .. doctest::
>>> class M(type):
... def __or__(self, other):
... return "Hello"
... >>> class C(metaclass=M):
... pass
... >>> C | int
'Hello'
>>> int | C
int | C | .. doctest::
>>> class M(type):
... def __or__(self, other):
... return "Hello"
... >>> class C(metaclass=M):
... pass
... >>> C | int
'Hello'
>>> int | C
int | C | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8f2f0b62-fdf6-4782-83ac-07c2a5928d27 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,140 | supabase-export-v2 | d6a0aa2461f5d931 | The limitation only applies to potentially slow conversions between :class:`int` and :class:`str` or :class:`bytes`:
* ``int(string)`` with default base 10. * ``int(string, base)`` for all bases that are not a power of 2. * ``str(integer)``. * ``repr(integer)``. * any other string conversion to base 10, for example ``f... | trusted_official_docs | CPython Docs | The limitation only applies to potentially slow conversions between :class:`int` and :class:`str` or :class:`bytes`:
* ``int(string)`` with default base 10. * ``int(string, base)`` for all bases that are not a power of 2. * ``str(integer)``. * ``repr(integer)``. * any other string conversion to base 10, for example ``f... | The limitation only applies to potentially slow conversions between :class:`int` and :class:`str` or :class:`bytes`:
* ``int(string)`` with default base 10. * ``int(string, base)`` for all bases that are not a power of 2. * ``str(integer)``. * ``repr(integer)``. * any other string conversion to base 10, for example ``f... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9156e0f3-4b4c-43cb-8aa0-a21334d026f9 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,023 | supabase-export-v2 | 4601d6df296f95aa | .. index:: pair: object; Union pair: union; type
A union object holds the value of the ``|`` (bitwise or) operation on
multiple :ref:`type objects <bltin-type-objects>`. These types are intended
primarily for :term:`type annotations <annotation>`. The union type expression
enables cleaner type hinting syntax compared t... | trusted_official_docs | CPython Docs | .. index:: pair: object; Union pair: union; type
A union object holds the value of the ``|`` (bitwise or) operation on
multiple :ref:`type objects <bltin-type-objects>`. These types are intended
primarily for :term:`type annotations <annotation>`. The union type expression
enables cleaner type hinting syntax compared t... | .. index:: pair: object; Union pair: union; type
A union object holds the value of the ``|`` (bitwise or) operation on
multiple :ref:`type objects <bltin-type-objects>`. These types are intended
primarily for :term:`type annotations <annotation>`. The union type expression
enables cleaner type hinting syntax compared t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
936b8727-858f-4421-b3ec-775453223228 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,983 | supabase-export-v2 | 842f5c6da4d51313 | def average(values: list[float]) -> float: return sum(values) / len(values)
Another example for :term:`mapping` objects, using a :class:`dict`, which
is a generic type expecting two type parameters representing the key type
and the value type. In this example, the function expects a ``dict`` with
keys of type :class... | trusted_official_docs | CPython Docs | def average(values: list[float]) -> float: return sum(values) / len(values)
Another example for :term:`mapping` objects, using a :class:`dict`, which
is a generic type expecting two type parameters representing the key type
and the value type. In this example, the function expects a ``dict`` with
keys of type :class... | def average(values: list[float]) -> float: return sum(values) / len(values)
Another example for :term:`mapping` objects, using a :class:`dict`, which
is a generic type expecting two type parameters representing the key type
and the value type. In this example, the function expects a ``dict`` with
keys of type :class... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
93e4ec35-4d89-49be-abfa-7c660cfef624 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,850 | supabase-export-v2 | dbac0efad6cec413 | .. versionchanged:: 3.7 Dictionary order is guaranteed to be insertion order. This behavior was an implementation detail of CPython from 3.6.
These are the operations that dictionaries support (and therefore, custom
mapping types should support too): | trusted_official_docs | CPython Docs | .. versionchanged:: 3.7 Dictionary order is guaranteed to be insertion order. This behavior was an implementation detail of CPython from 3.6.
These are the operations that dictionaries support (and therefore, custom
mapping types should support too): | .. versionchanged:: 3.7 Dictionary order is guaranteed to be insertion order. This behavior was an implementation detail of CPython from 3.6.
These are the operations that dictionaries support (and therefore, custom
mapping types should support too): | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9596886a-a23b-4048-9740-a481ee888e40 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,979 | supabase-export-v2 | 4e1d1dfc4f74bfb3 | values of ``y.group(0)`` and ``y[0]`` will both be of type :class:`bytes`. In type annotations, we would represent this variety of :ref:`re.Match <match-objects>` objects with ``re.Match[bytes]``.
``GenericAlias`` objects are instances of the class
:class:`types.GenericAlias`, which can also be used to create ``Generic... | trusted_official_docs | CPython Docs | values of ``y.group(0)`` and ``y[0]`` will both be of type :class:`bytes`. In type annotations, we would represent this variety of :ref:`re.Match <match-objects>` objects with ``re.Match[bytes]``.
``GenericAlias`` objects are instances of the class
:class:`types.GenericAlias`, which can also be used to create ``Generic... | values of ``y.group(0)`` and ``y[0]`` will both be of type :class:`bytes`. In type annotations, we would represent this variety of :ref:`re.Match <match-objects>` objects with ``re.Match[bytes]``.
``GenericAlias`` objects are instances of the class
:class:`types.GenericAlias`, which can also be used to create ``Generic... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9cf0813e-6725-4f03-89b2-4b7b30cbca8a | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,835 | supabase-export-v2 | ecc3248529ecc878 | Mapping types --- :class:`!dict`, :class:`!frozendict` ======================================================
.. index::
pair: object; mapping
pair: object; dictionary
triple: operations on; mapping; types
triple: operations on; dictionary; type
pair: statement; del
pair: built-in function; len | trusted_official_docs | CPython Docs | Mapping types --- :class:`!dict`, :class:`!frozendict` ======================================================
.. index::
pair: object; mapping
pair: object; dictionary
triple: operations on; mapping; types
triple: operations on; dictionary; type
pair: statement; del
pair: built-in function; len | Mapping types --- :class:`!dict`, :class:`!frozendict` ======================================================
.. index::
pair: object; mapping
pair: object; dictionary
triple: operations on; mapping; types
triple: operations on; dictionary; type
pair: statement; del
pair: built-in function; len | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9fde7022-ba51-4d8d-bdc3-86011c53a710 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,859 | supabase-export-v2 | 2b9a7ba02423df1e | other operations or methods invoke :meth:`~object.__missing__`. If :meth:`~object.__missing__` is not defined, :exc:`KeyError` is raised. :meth:`~object.__missing__` must be a method; it cannot be an instance variable::
>>> class Counter(dict):
... def __missing__(self, key):
... return 0
... >>> c = Counter()
>>> ... | trusted_official_docs | CPython Docs | other operations or methods invoke :meth:`~object.__missing__`. If :meth:`~object.__missing__` is not defined, :exc:`KeyError` is raised. :meth:`~object.__missing__` must be a method; it cannot be an instance variable::
>>> class Counter(dict):
... def __missing__(self, key):
... return 0
... >>> c = Counter()
>>> ... | other operations or methods invoke :meth:`~object.__missing__`. If :meth:`~object.__missing__` is not defined, :exc:`KeyError` is raised. :meth:`~object.__missing__` must be a method; it cannot be an instance variable::
>>> class Counter(dict):
... def __missing__(self, key):
... return 0
... >>> c = Counter()
>>> ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9ffb8979-1318-430a-a8ed-b95d3aba6cfc | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,844 | supabase-export-v2 | 740f65567a902ee4 | from the positional argument. If a key being added is already present, the value from the keyword argument replaces the value from the positional argument.
Dictionaries compare equal if and only if they have the same ``(key,
value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', '>') raise
:exc:... | trusted_official_docs | CPython Docs | from the positional argument. If a key being added is already present, the value from the keyword argument replaces the value from the positional argument.
Dictionaries compare equal if and only if they have the same ``(key,
value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', '>') raise
:exc:... | from the positional argument. If a key being added is already present, the value from the keyword argument replaces the value from the positional argument.
Dictionaries compare equal if and only if they have the same ``(key,
value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', '>') raise
:exc:... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a05ea2f2-bbfc-4e64-b173-d849b11f6b6c | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,769 | supabase-export-v2 | eeb4f6fe96620e20 | Being an unordered collection, sets do not record element position or order of insertion. Accordingly, sets do not support indexing, slicing, or other sequence-like behavior.
There are currently two built-in set types, :class:`set` and :class:`frozenset`. The :class:`set` type is mutable --- the contents can be changed... | trusted_official_docs | CPython Docs | Being an unordered collection, sets do not record element position or order of insertion. Accordingly, sets do not support indexing, slicing, or other sequence-like behavior.
There are currently two built-in set types, :class:`set` and :class:`frozenset`. The :class:`set` type is mutable --- the contents can be changed... | Being an unordered collection, sets do not record element position or order of insertion. Accordingly, sets do not support indexing, slicing, or other sequence-like behavior.
There are currently two built-in set types, :class:`set` and :class:`frozenset`. The :class:`set` type is mutable --- the contents can be changed... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a0f6472b-f99d-4b47-98cb-d7ba7e291680 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,947 | supabase-export-v2 | 1dc1f8ad26d11d68 | * A :class:`!frozendict` can be hashed with ``hash(frozendict)`` if all keys and values can be hashed.
* ``frozendict |= other`` does not modify the :class:`!frozendict` in-place but
creates a new frozen dictionary. | trusted_official_docs | CPython Docs | * A :class:`!frozendict` can be hashed with ``hash(frozendict)`` if all keys and values can be hashed.
* ``frozendict |= other`` does not modify the :class:`!frozendict` in-place but
creates a new frozen dictionary. | * A :class:`!frozendict` can be hashed with ``hash(frozendict)`` if all keys and values can be hashed.
* ``frozendict |= other`` does not modify the :class:`!frozendict` in-place but
creates a new frozen dictionary. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a3c4dd67-cadc-4b51-8d11-c0266c094a1a | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,923 | supabase-export-v2 | 69174fa9510dd29b | Iterating views while adding or deleting entries in the dictionary may raise a :exc:`RuntimeError` or fail to iterate over all entries.
.. versionchanged:: 3.7
Dictionary order is guaranteed to be insertion order. | trusted_official_docs | CPython Docs | Iterating views while adding or deleting entries in the dictionary may raise a :exc:`RuntimeError` or fail to iterate over all entries.
.. versionchanged:: 3.7
Dictionary order is guaranteed to be insertion order. | Iterating views while adding or deleting entries in the dictionary may raise a :exc:`RuntimeError` or fail to iterate over all entries.
.. versionchanged:: 3.7
Dictionary order is guaranteed to be insertion order. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a591f467-3a25-4ebd-b670-645e4a8d5750 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,068 | supabase-export-v2 | 6ef4652faf798821 | objects: built-in functions and user-defined functions. Both support the same operation (to call the function), but the implementation is different, hence the different object types.
See :ref:`function` for more information. | trusted_official_docs | CPython Docs | objects: built-in functions and user-defined functions. Both support the same operation (to call the function), but the implementation is different, hence the different object types.
See :ref:`function` for more information. | objects: built-in functions and user-defined functions. Both support the same operation (to call the function), but the implementation is different, hence the different object types.
See :ref:`function` for more information. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a59ce48a-3eac-42a0-9261-e332436d8789 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,156 | supabase-export-v2 | 011bcc6d0f64dd8e | Example::
>>> import sys
>>> if hasattr(sys, "set_int_max_str_digits"):
... upper_bound = 68000
... lower_bound = 4004
... current_limit = sys.get_int_max_str_digits()
... if current_limit == 0 or current_limit > upper_bound:
... sys.set_int_max_str_digits(upper_bound)
... elif current_limit < lower_bound:
... ... | trusted_official_docs | CPython Docs | Example::
>>> import sys
>>> if hasattr(sys, "set_int_max_str_digits"):
... upper_bound = 68000
... lower_bound = 4004
... current_limit = sys.get_int_max_str_digits()
... if current_limit == 0 or current_limit > upper_bound:
... sys.set_int_max_str_digits(upper_bound)
... elif current_limit < lower_bound:
... ... | Example::
>>> import sys
>>> if hasattr(sys, "set_int_max_str_digits"):
... upper_bound = 68000
... lower_bound = 4004
... current_limit = sys.get_int_max_str_digits()
... if current_limit == 0 or current_limit > upper_bound:
... sys.set_int_max_str_digits(upper_bound)
... elif current_limit < lower_bound:
... ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a9aaac89-c0d1-4e16-8afb-158cf5c36f2a | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,745 | supabase-export-v2 | c5ae9a46f048bd9d | The size in bytes of each element of the memoryview::
>>> import array, struct
>>> m = memoryview(array.array('H', [32000, 32001, 32002]))
>>> m.itemsize
2
>>> m[0]
32000
>>> struct.calcsize('H') == m.itemsize
True | trusted_official_docs | CPython Docs | The size in bytes of each element of the memoryview::
>>> import array, struct
>>> m = memoryview(array.array('H', [32000, 32001, 32002]))
>>> m.itemsize
2
>>> m[0]
32000
>>> struct.calcsize('H') == m.itemsize
True | The size in bytes of each element of the memoryview::
>>> import array, struct
>>> m = memoryview(array.array('H', [32000, 32001, 32002]))
>>> m.itemsize
2
>>> m[0]
32000
>>> struct.calcsize('H') == m.itemsize
True | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ae394ef4-2c38-4bee-b959-1286dfa85ff2 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,147 | supabase-export-v2 | adef1221cc9294ff | From code, you can inspect the current limit and set a new one using these :mod:`sys` APIs:
* :func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` are
a getter and setter for the interpreter-wide limit. Subinterpreters have
their own limit. | trusted_official_docs | CPython Docs | From code, you can inspect the current limit and set a new one using these :mod:`sys` APIs:
* :func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` are
a getter and setter for the interpreter-wide limit. Subinterpreters have
their own limit. | From code, you can inspect the current limit and set a new one using these :mod:`sys` APIs:
* :func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` are
a getter and setter for the interpreter-wide limit. Subinterpreters have
their own limit. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ae885c4a-eda7-4976-abfd-83de3d615b04 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,909 | supabase-export-v2 | 436cb2b098bfe29d | 3, 'four': 4} >>> list(reversed(d)) ['four', 'three', 'two', 'one'] >>> list(reversed(d.values())) [4, 3, 2, 1] >>> list(reversed(d.items())) [('four', 4), ('three', 3), ('two', 2), ('one', 1)]
.. versionchanged:: 3.8
Dictionaries are now reversible. | trusted_official_docs | CPython Docs | 3, 'four': 4} >>> list(reversed(d)) ['four', 'three', 'two', 'one'] >>> list(reversed(d.values())) [4, 3, 2, 1] >>> list(reversed(d.items())) [('four', 4), ('three', 3), ('two', 2), ('one', 1)]
.. versionchanged:: 3.8
Dictionaries are now reversible. | 3, 'four': 4} >>> list(reversed(d)) ['four', 'three', 'two', 'one'] >>> list(reversed(d.values())) [4, 3, 2, 1] >>> list(reversed(d.items())) [('four', 4), ('three', 3), ('two', 2), ('one', 1)]
.. versionchanged:: 3.8
Dictionaries are now reversible. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
af2eba1e-cdb8-44e9-8393-9f6f19fdb0d2 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,070 | supabase-export-v2 | b3116c5b01a352e0 | .. index:: pair: object; method
Methods are functions that are called using the attribute notation. There are two flavors: :ref:`built-in methods <builtin-methods>`
(such as :meth:`~list.append` on lists)
and :ref:`class instance method <instance-methods>`. Built-in methods are described with the types that support the... | trusted_official_docs | CPython Docs | .. index:: pair: object; method
Methods are functions that are called using the attribute notation. There are two flavors: :ref:`built-in methods <builtin-methods>`
(such as :meth:`~list.append` on lists)
and :ref:`class instance method <instance-methods>`. Built-in methods are described with the types that support the... | .. index:: pair: object; method
Methods are functions that are called using the attribute notation. There are two flavors: :ref:`built-in methods <builtin-methods>`
(such as :meth:`~list.append` on lists)
and :ref:`class instance method <instance-methods>`. Built-in methods are described with the types that support the... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b10f58b2-679a-48cc-9863-5ebeee053273 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,750 | supabase-export-v2 | f89dd3c4dfff5f24 | A tuple of integers the length of :attr:`ndim` giving the shape of the memory as an N-dimensional array.
.. versionchanged:: 3.3
An empty tuple instead of ``None`` when ndim = 0. | trusted_official_docs | CPython Docs | A tuple of integers the length of :attr:`ndim` giving the shape of the memory as an N-dimensional array.
.. versionchanged:: 3.3
An empty tuple instead of ``None`` when ndim = 0. | A tuple of integers the length of :attr:`ndim` giving the shape of the memory as an N-dimensional array.
.. versionchanged:: 3.3
An empty tuple instead of ``None`` when ndim = 0. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b4cc4652-374a-40bd-9045-7c4352def2e5 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,079 | supabase-export-v2 | 849f3b383b6c25fe | .. index:: pair: built-in function; compile single: __code__ (function object attribute)
Code objects are used by the implementation to represent "pseudo-compiled"
executable Python code such as a function body. They differ from function
objects because they don't contain a reference to their global execution
environme... | trusted_official_docs | CPython Docs | .. index:: pair: built-in function; compile single: __code__ (function object attribute)
Code objects are used by the implementation to represent "pseudo-compiled"
executable Python code such as a function body. They differ from function
objects because they don't contain a reference to their global execution
environme... | .. index:: pair: built-in function; compile single: __code__ (function object attribute)
Code objects are used by the implementation to represent "pseudo-compiled"
executable Python code such as a function body. They differ from function
objects because they don't contain a reference to their global execution
environme... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b75b5203-0faa-4200-8b4b-886f75a92292 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,807 | supabase-export-v2 | f224036a6ffb7c1e | two nonempty disjoint sets are not equal and are not subsets of each other, so *all* of the following return ``False``: ``a<b``, ``a==b``, or ``a>b``.
Since sets only define partial ordering (subset relationships), the output of
the :meth:`list.sort` method is undefined for lists of sets. | trusted_official_docs | CPython Docs | two nonempty disjoint sets are not equal and are not subsets of each other, so *all* of the following return ``False``: ``a<b``, ``a==b``, or ``a>b``.
Since sets only define partial ordering (subset relationships), the output of
the :meth:`list.sort` method is undefined for lists of sets. | two nonempty disjoint sets are not equal and are not subsets of each other, so *all* of the following return ``False``: ``a<b``, ``a==b``, or ``a>b``.
Since sets only define partial ordering (subset relationships), the output of
the :meth:`list.sort` method is undefined for lists of sets. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b792efaf-4bd7-4ed4-8703-2617f0507e8f | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,978 | supabase-export-v2 | 73c9172a1d5440f3 | values of ``x.group(0)`` and ``x[0]`` will both be of type :class:`str`. We can represent this kind of object in type annotations with the ``GenericAlias`` ``re.Match[str]``.
* If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`),
``y`` will also be an instance of ``re.Match``, but the return
val... | trusted_official_docs | CPython Docs | values of ``x.group(0)`` and ``x[0]`` will both be of type :class:`str`. We can represent this kind of object in type annotations with the ``GenericAlias`` ``re.Match[str]``.
* If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`),
``y`` will also be an instance of ``re.Match``, but the return
val... | values of ``x.group(0)`` and ``x[0]`` will both be of type :class:`str`. We can represent this kind of object in type annotations with the ``GenericAlias`` ``re.Match[str]``.
* If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`),
``y`` will also be an instance of ``re.Match``, but the return
val... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ba66ac60-433d-4134-a7f0-dd1c505de0c4 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,810 | supabase-export-v2 | 03e981cd801721af | Binary operations that mix :class:`set` instances with :class:`frozenset` return the type of the first operand. For example: ``frozenset('ab') | set('bc')`` returns an instance of :class:`frozenset`.
The following table lists operations available for :class:`set` that do not
apply to immutable instances of :class:`froz... | trusted_official_docs | CPython Docs | Binary operations that mix :class:`set` instances with :class:`frozenset` return the type of the first operand. For example: ``frozenset('ab') | set('bc')`` returns an instance of :class:`frozenset`.
The following table lists operations available for :class:`set` that do not
apply to immutable instances of :class:`froz... | Binary operations that mix :class:`set` instances with :class:`frozenset` return the type of the first operand. For example: ``frozenset('ab') | set('bc')`` returns an instance of :class:`frozenset`.
The following table lists operations available for :class:`set` that do not
apply to immutable instances of :class:`froz... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bd363fb6-d971-4947-a71d-f41f4598507b | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,846 | supabase-export-v2 | a1daf7c2c46cb85a | 'one': 1, 'two': 2}) >>> f = dict({'one': 1, 'three': 3}, two=2) >>> a == b == c == d == e == f True
Providing keyword arguments as in the first example only works for keys that
are valid Python identifiers. Otherwise, any valid keys can be used. | trusted_official_docs | CPython Docs | 'one': 1, 'two': 2}) >>> f = dict({'one': 1, 'three': 3}, two=2) >>> a == b == c == d == e == f True
Providing keyword arguments as in the first example only works for keys that
are valid Python identifiers. Otherwise, any valid keys can be used. | 'one': 1, 'two': 2}) >>> f = dict({'one': 1, 'three': 3}, two=2) >>> a == b == c == d == e == f True
Providing keyword arguments as in the first example only works for keys that
are valid Python identifiers. Otherwise, any valid keys can be used. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bdc504e6-d1d5-4dc9-8697-d2fc8bbd8bf0 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,086 | supabase-export-v2 | 09ae8ef21c31cac0 | .. index:: pair: built-in function; type pair: module; types
Type objects represent the various object types. An object's type is accessed
by the built-in function :func:`type`. There are no special operations on
types. The standard module :mod:`types` defines names for all standard built-in
types. | trusted_official_docs | CPython Docs | .. index:: pair: built-in function; type pair: module; types
Type objects represent the various object types. An object's type is accessed
by the built-in function :func:`type`. There are no special operations on
types. The standard module :mod:`types` defines names for all standard built-in
types. | .. index:: pair: built-in function; type pair: module; types
Type objects represent the various object types. An object's type is accessed
by the built-in function :func:`type`. There are no special operations on
types. The standard module :mod:`types` defines names for all standard built-in
types. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bdd53dad-b918-4e84-b462-1806830ac081 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,128 | supabase-export-v2 | 2d751b4339ca70ff | service attacks. This limit *only* applies to decimal or other non-power-of-two number bases. Hexadecimal, octal, and binary conversions are unlimited. The limit can be configured.
The :class:`int` type in CPython is an arbitrary length number stored in binary
form (commonly known as a "bignum"). There exists no algori... | trusted_official_docs | CPython Docs | service attacks. This limit *only* applies to decimal or other non-power-of-two number bases. Hexadecimal, octal, and binary conversions are unlimited. The limit can be configured.
The :class:`int` type in CPython is an arbitrary length number stored in binary
form (commonly known as a "bignum"). There exists no algori... | service attacks. This limit *only* applies to decimal or other non-power-of-two number bases. Hexadecimal, octal, and binary conversions are unlimited. The limit can be configured.
The :class:`int` type in CPython is an arbitrary length number stored in binary
form (commonly known as a "bignum"). There exists no algori... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bdfdaa70-de9c-423b-a6ab-56bfe349a063 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,141 | supabase-export-v2 | 25de605fa4b7d328 | not a power of 2. * ``str(integer)``. * ``repr(integer)``. * any other string conversion to base 10, for example ``f"{integer}"``, ``"{}".format(integer)``, or ``b"%d" % integer``.
The limitations do not apply to functions with a linear algorithm: | trusted_official_docs | CPython Docs | not a power of 2. * ``str(integer)``. * ``repr(integer)``. * any other string conversion to base 10, for example ``f"{integer}"``, ``"{}".format(integer)``, or ``b"%d" % integer``.
The limitations do not apply to functions with a linear algorithm: | not a power of 2. * ``str(integer)``. * ``repr(integer)``. * any other string conversion to base 10, for example ``f"{integer}"``, ``"{}".format(integer)``, or ``b"%d" % integer``.
The limitations do not apply to functions with a linear algorithm: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bfacfc63-a38b-445a-8ed4-397b3c1615ca | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,836 | supabase-export-v2 | c139559cbe271123 | .. index:: pair: object; mapping pair: object; dictionary triple: operations on; mapping; types triple: operations on; dictionary; type pair: statement; del pair: built-in function; len
A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. There are currently two standard mapping types, the :dfn:`... | trusted_official_docs | CPython Docs | .. index:: pair: object; mapping pair: object; dictionary triple: operations on; mapping; types triple: operations on; dictionary; type pair: statement; del pair: built-in function; len
A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. There are currently two standard mapping types, the :dfn:`... | .. index:: pair: object; mapping pair: object; dictionary triple: operations on; mapping; types triple: operations on; dictionary; type pair: statement; del pair: built-in function; len
A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. There are currently two standard mapping types, the :dfn:`... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c198ec4c-11cd-4e2d-a55b-2c3537d69f41 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,922 | supabase-export-v2 | f05824a943b14018 | key)`` pairs using :func:`zip`: ``pairs = zip(d.values(), d.keys())``. Another way to create the same list is ``pairs = [(v, k) for (k, v) in d.items()]``.
Iterating views while adding or deleting entries in the dictionary may raise
a :exc:`RuntimeError` or fail to iterate over all entries. | trusted_official_docs | CPython Docs | key)`` pairs using :func:`zip`: ``pairs = zip(d.values(), d.keys())``. Another way to create the same list is ``pairs = [(v, k) for (k, v) in d.items()]``.
Iterating views while adding or deleting entries in the dictionary may raise
a :exc:`RuntimeError` or fail to iterate over all entries. | key)`` pairs using :func:`zip`: ``pairs = zip(d.values(), d.keys())``. Another way to create the same list is ``pairs = [(v, k) for (k, v) in d.items()]``.
Iterating views while adding or deleting entries in the dictionary may raise
a :exc:`RuntimeError` or fail to iterate over all entries. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c48d1394-bcc4-453f-868a-e436420ea370 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,842 | supabase-export-v2 | 0b24521113606200 | Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}`` * Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', 200)])``, ``dict(foo=100, bar=200)``
If no positional argument is given, an empty dictionary is created. If a positional argument is given and it defines a ``keys()`` method, a
dic... | trusted_official_docs | CPython Docs | Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}`` * Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', 200)])``, ``dict(foo=100, bar=200)``
If no positional argument is given, an empty dictionary is created. If a positional argument is given and it defines a ``keys()`` method, a
dic... | Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}`` * Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', 200)])``, ``dict(foo=100, bar=200)``
If no positional argument is given, an empty dictionary is created. If a positional argument is given and it defines a ``keys()`` method, a
dic... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c7b9634b-66df-41ac-bf02-34a9798b3165 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,958 | supabase-export-v2 | fa66e34afcda6599 | .. method:: contextmanager.__exit__(exc_type, exc_val, exc_tb)
Exit the runtime context and return a Boolean flag indicating if any exception
that occurred should be suppressed. If an exception occurred while executing the
body of the :keyword:`with` statement, the arguments contain the exception type,
value and tra... | trusted_official_docs | CPython Docs | .. method:: contextmanager.__exit__(exc_type, exc_val, exc_tb)
Exit the runtime context and return a Boolean flag indicating if any exception
that occurred should be suppressed. If an exception occurred while executing the
body of the :keyword:`with` statement, the arguments contain the exception type,
value and tra... | .. method:: contextmanager.__exit__(exc_type, exc_val, exc_tb)
Exit the runtime context and return a Boolean flag indicating if any exception
that occurred should be suppressed. If an exception occurred while executing the
body of the :keyword:`with` statement, the arguments contain the exception type,
value and tra... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c9b07e59-d144-4355-8565-2aee9c499d26 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,895 | supabase-export-v2 | 53c153101aa4fa97 | If *key* is in the dictionary, return its value. If not, insert *key* with a value of *default* and return *default*. *default* defaults to ``None``.
.. method:: update(**kwargs)
update(mapping, /, **kwargs)
update(iterable, /, **kwargs) | trusted_official_docs | CPython Docs | If *key* is in the dictionary, return its value. If not, insert *key* with a value of *default* and return *default*. *default* defaults to ``None``.
.. method:: update(**kwargs)
update(mapping, /, **kwargs)
update(iterable, /, **kwargs) | If *key* is in the dictionary, return its value. If not, insert *key* with a value of *default* and return *default*. *default* defaults to ``None``.
.. method:: update(**kwargs)
update(mapping, /, **kwargs)
update(iterable, /, **kwargs) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c9f159fc-92c4-4e12-85d3-e4f51b65e4c2 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,965 | supabase-export-v2 | 9f39e1b8c9d8a135 | a normal Python accessible method. Compared to the overhead of setting up the runtime context, the overhead of a single class dictionary lookup is negligible.
Type Annotation Types --- :ref:`Generic Alias <types-genericalias>`, :ref:`Union <types-union>`
=================================================================... | trusted_official_docs | CPython Docs | a normal Python accessible method. Compared to the overhead of setting up the runtime context, the overhead of a single class dictionary lookup is negligible.
Type Annotation Types --- :ref:`Generic Alias <types-genericalias>`, :ref:`Union <types-union>`
=================================================================... | a normal Python accessible method. Compared to the overhead of setting up the runtime context, the overhead of a single class dictionary lookup is negligible.
Type Annotation Types --- :ref:`Generic Alias <types-genericalias>`, :ref:`Union <types-union>`
=================================================================... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ca65b70f-68b2-4d43-a4d0-20f99fd375bf | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,131 | supabase-export-v2 | b5a1e18788272baa | characters in the input or output string when a non-linear conversion algorithm would be involved. Underscores and the sign are not counted towards the limit.
When an operation would exceed the limit, a :exc:`ValueError` is raised: | trusted_official_docs | CPython Docs | characters in the input or output string when a non-linear conversion algorithm would be involved. Underscores and the sign are not counted towards the limit.
When an operation would exceed the limit, a :exc:`ValueError` is raised: | characters in the input or output string when a non-linear conversion algorithm would be involved. Underscores and the sign are not counted towards the limit.
When an operation would exceed the limit, a :exc:`ValueError` is raised: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ca65cfc3-7769-4060-a9fe-3c3da84035d6 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,998 | supabase-export-v2 | 84c65f97b147e64b | when :ref:`type variables <generics>` are used. The index must have as many elements as there are type variable items in the ``GenericAlias`` object's :attr:`~genericalias.__args__`. ::
>>> from typing import TypeVar
>>> Y = TypeVar('Y')
>>> dict[str, Y][int]
dict[str, int] | trusted_official_docs | CPython Docs | when :ref:`type variables <generics>` are used. The index must have as many elements as there are type variable items in the ``GenericAlias`` object's :attr:`~genericalias.__args__`. ::
>>> from typing import TypeVar
>>> Y = TypeVar('Y')
>>> dict[str, Y][int]
dict[str, int] | when :ref:`type variables <generics>` are used. The index must have as many elements as there are type variable items in the ``GenericAlias`` object's :attr:`~genericalias.__args__`. ::
>>> from typing import TypeVar
>>> Y = TypeVar('Y')
>>> dict[str, Y][int]
dict[str, int] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cc16adb5-87f1-4c37-93d8-0a0990614521 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,982 | supabase-export-v2 | dd58db391a60feab | a type ``T`` parameterized by types *X*, *Y*, and more depending on the ``T`` used. For example, a function expecting a :class:`list` containing :class:`float` elements::
def average(values: list[float]) -> float:
return sum(values) / len(values) | trusted_official_docs | CPython Docs | a type ``T`` parameterized by types *X*, *Y*, and more depending on the ``T`` used. For example, a function expecting a :class:`list` containing :class:`float` elements::
def average(values: list[float]) -> float:
return sum(values) / len(values) | a type ``T`` parameterized by types *X*, *Y*, and more depending on the ``T`` used. For example, a function expecting a :class:`list` containing :class:`float` elements::
def average(values: list[float]) -> float:
return sum(values) / len(values) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cd272190-c2aa-4a00-bbef-a3cb57fb3da1 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,962 | supabase-export-v2 | ea2caff108cad35d | does not want to suppress the raised exception. This allows context management code to easily detect whether or not an :meth:`~object.__exit__` method has actually failed.
Python defines several context managers to support easy thread synchronisation,
prompt closure of files or other objects, and simpler manipulation o... | trusted_official_docs | CPython Docs | does not want to suppress the raised exception. This allows context management code to easily detect whether or not an :meth:`~object.__exit__` method has actually failed.
Python defines several context managers to support easy thread synchronisation,
prompt closure of files or other objects, and simpler manipulation o... | does not want to suppress the raised exception. This allows context management code to easily detect whether or not an :meth:`~object.__exit__` method has actually failed.
Python defines several context managers to support easy thread synchronisation,
prompt closure of files or other objects, and simpler manipulation o... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cdd4de9f-e821-42bd-b907-b49e58bac856 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,838 | supabase-export-v2 | 7178f5edd3975760 | not be used as keys. Values that compare equal (such as ``1``, ``1.0``, and ``True``) can be used interchangeably to index the same dictionary entry.
.. class:: dict(**kwargs)
dict(mapping, /, **kwargs)
dict(iterable, /, **kwargs) | trusted_official_docs | CPython Docs | not be used as keys. Values that compare equal (such as ``1``, ``1.0``, and ``True``) can be used interchangeably to index the same dictionary entry.
.. class:: dict(**kwargs)
dict(mapping, /, **kwargs)
dict(iterable, /, **kwargs) | not be used as keys. Values that compare equal (such as ``1``, ``1.0``, and ``True``) can be used interchangeably to index the same dictionary entry.
.. class:: dict(**kwargs)
dict(mapping, /, **kwargs)
dict(iterable, /, **kwargs) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d102c233-0c52-4ee8-add8-e1910a72eafe | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,841 | supabase-export-v2 | c4ac9bc1c7825131 | Dictionaries can be created by several means:
* Use a comma-separated list of ``key: value`` pairs within braces:
``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``
* Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``
* Use the type constructor: ``dict()``,
``dict([('foo', 10... | trusted_official_docs | CPython Docs | Dictionaries can be created by several means:
* Use a comma-separated list of ``key: value`` pairs within braces:
``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``
* Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``
* Use the type constructor: ``dict()``,
``dict([('foo', 10... | Dictionaries can be created by several means:
* Use a comma-separated list of ``key: value`` pairs within braces:
``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``
* Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``
* Use the type constructor: ``dict()``,
``dict([('foo', 10... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d4c77278-bb03-45b2-b1f8-cad28d436879 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,987 | supabase-export-v2 | 113d22e9fa1b18d6 | >>> isinstance([1, 2], list[str]) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: isinstance() argument 2 cannot be a parameterized generic
The Python runtime does not enforce :term:`type annotations <annotation>`. This extends to generic types and their type parameters. When creating
... | trusted_official_docs | CPython Docs | >>> isinstance([1, 2], list[str]) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: isinstance() argument 2 cannot be a parameterized generic
The Python runtime does not enforce :term:`type annotations <annotation>`. This extends to generic types and their type parameters. When creating
... | >>> isinstance([1, 2], list[str]) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: isinstance() argument 2 cannot be a parameterized generic
The Python runtime does not enforce :term:`type annotations <annotation>`. This extends to generic types and their type parameters. When creating
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d5e80ea8-f4e7-4c3a-97e2-3ebd90248e53 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,830 | supabase-export-v2 | 83aa404ea6f486b7 | Note, the non-operator versions of the :meth:`~set.update`, :meth:`~set.intersection_update`, :meth:`~set.difference_update`, and :meth:`~set.symmetric_difference_update` methods will accept any iterable as an argument.
Note, the *elem* argument to the :meth:`~object.__contains__`,
:meth:`~set.remove`, and
:meth:`~set.... | trusted_official_docs | CPython Docs | Note, the non-operator versions of the :meth:`~set.update`, :meth:`~set.intersection_update`, :meth:`~set.difference_update`, and :meth:`~set.symmetric_difference_update` methods will accept any iterable as an argument.
Note, the *elem* argument to the :meth:`~object.__contains__`,
:meth:`~set.remove`, and
:meth:`~set.... | Note, the non-operator versions of the :meth:`~set.update`, :meth:`~set.intersection_update`, :meth:`~set.difference_update`, and :meth:`~set.symmetric_difference_update` methods will accept any iterable as an argument.
Note, the *elem* argument to the :meth:`~object.__contains__`,
:meth:`~set.remove`, and
:meth:`~set.... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dc647917-e092-485e-851e-4d6e3ac28b13 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,090 | supabase-export-v2 | 1fdd93ae39dc6f78 | The Null Object ---------------
This object is returned by functions that don't explicitly return a value. It
supports no special operations. There is exactly one null object, named
``None`` (a built-in name). ``type(None)()`` produces the same singleton. | trusted_official_docs | CPython Docs | The Null Object ---------------
This object is returned by functions that don't explicitly return a value. It
supports no special operations. There is exactly one null object, named
``None`` (a built-in name). ``type(None)()`` produces the same singleton. | The Null Object ---------------
This object is returned by functions that don't explicitly return a value. It
supports no special operations. There is exactly one null object, named
``None`` (a built-in name). ``type(None)()`` produces the same singleton. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
de73fa86-90da-497d-a64c-8c8cb03600f7 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,916 | supabase-export-v2 | 383b856583382727 | :meth:`dict.items` are *view objects*. They provide a dynamic view on the dictionary's entries, which means that when the dictionary changes, the view reflects these changes.
Dictionary views can be iterated over to yield their respective data, and
support membership tests: | trusted_official_docs | CPython Docs | :meth:`dict.items` are *view objects*. They provide a dynamic view on the dictionary's entries, which means that when the dictionary changes, the view reflects these changes.
Dictionary views can be iterated over to yield their respective data, and
support membership tests: | :meth:`dict.items` are *view objects*. They provide a dynamic view on the dictionary's entries, which means that when the dictionary changes, the view reflects these changes.
Dictionary views can be iterated over to yield their respective data, and
support membership tests: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
df962bf9-24d8-483d-8723-843f1b19d4a4 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,858 | supabase-export-v2 | 54e1b3ac6b6d88d8 | .. index:: __missing__()
If a subclass of dict defines a method :meth:`~object.__missing__` and *key*
is not present, the ``d[key]`` operation calls that method with the key *key*
as argument. The ``d[key]`` operation then returns or raises whatever is
returned or raised by the ``__missing__(key)`` call. No other op... | trusted_official_docs | CPython Docs | .. index:: __missing__()
If a subclass of dict defines a method :meth:`~object.__missing__` and *key*
is not present, the ``d[key]`` operation calls that method with the key *key*
as argument. The ``d[key]`` operation then returns or raises whatever is
returned or raised by the ``__missing__(key)`` call. No other op... | .. index:: __missing__()
If a subclass of dict defines a method :meth:`~object.__missing__` and *key*
is not present, the ``d[key]`` operation calls that method with the key *key*
as argument. The ``d[key]`` operation then returns or raises whatever is
returned or raised by the ``__missing__(key)`` call. No other op... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e149bba6-fc92-4a6f-a0d8-20689531e69e | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,061 | supabase-export-v2 | 46e1312bac3c4dc0 | (you can write ``m.__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't write ``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is not recommended.
Modules built into the interpreter are written like this: ``<module 'sys'
(built-in)>``. If loaded from a file, they are written as ``<modu... | trusted_official_docs | CPython Docs | (you can write ``m.__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't write ``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is not recommended.
Modules built into the interpreter are written like this: ``<module 'sys'
(built-in)>``. If loaded from a file, they are written as ``<modu... | (you can write ``m.__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't write ``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is not recommended.
Modules built into the interpreter are written like this: ``<module 'sys'
(built-in)>``. If loaded from a file, they are written as ``<modu... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e1b9ab7b-09bc-477e-93be-2d8ce278b8ea | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,734 | supabase-export-v2 | 3305876ba74f290b | .. attribute:: nbytes
``nbytes == product(shape) * itemsize == len(m.tobytes())``. This is
the amount of space in bytes that the array would use in a contiguous
representation. It is not necessarily equal to ``len(m)``:: | trusted_official_docs | CPython Docs | .. attribute:: nbytes
``nbytes == product(shape) * itemsize == len(m.tobytes())``. This is
the amount of space in bytes that the array would use in a contiguous
representation. It is not necessarily equal to ``len(m)``:: | .. attribute:: nbytes
``nbytes == product(shape) * itemsize == len(m.tobytes())``. This is
the amount of space in bytes that the array would use in a contiguous
representation. It is not necessarily equal to ``len(m)``:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e39259f2-a833-476c-aeaf-4e7b4969d5bf | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,026 | supabase-export-v2 | 44fcd9eb02d56d06 | Y`` means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For example, the following function expects an argument of type :class:`int` or :class:`float`::
def square(number: int | float) -> int | float:
return number ** 2 | trusted_official_docs | CPython Docs | Y`` means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For example, the following function expects an argument of type :class:`int` or :class:`float`::
def square(number: int | float) -> int | float:
return number ** 2 | Y`` means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For example, the following function expects an argument of type :class:`int` or :class:`float`::
def square(number: int | float) -> int | float:
return number ** 2 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e3a04c30-64ac-40f1-bfc8-6cd8453bb6c9 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,784 | supabase-export-v2 | 78bd38db4836da14 | .. method:: frozenset.isdisjoint(other, /) set.isdisjoint(other, /)
Return ``True`` if the set has no elements in common with *other*. Sets are
disjoint if and only if their intersection is the empty set. | trusted_official_docs | CPython Docs | .. method:: frozenset.isdisjoint(other, /) set.isdisjoint(other, /)
Return ``True`` if the set has no elements in common with *other*. Sets are
disjoint if and only if their intersection is the empty set. | .. method:: frozenset.isdisjoint(other, /) set.isdisjoint(other, /)
Return ``True`` if the set has no elements in common with *other*. Sets are
disjoint if and only if their intersection is the empty set. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e45f9b81-b06e-4e9d-aa91-8fb8e871ff10 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,014 | supabase-export-v2 | 39bdc65cef29599f | >>> T = TypeVar('T') >>> list[T].__parameters__ (~T,)
.. note::
A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not
have correct ``__parameters__`` after substitution because
:class:`typing.ParamSpec` is intended primarily for static type checking. | trusted_official_docs | CPython Docs | >>> T = TypeVar('T') >>> list[T].__parameters__ (~T,)
.. note::
A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not
have correct ``__parameters__`` after substitution because
:class:`typing.ParamSpec` is intended primarily for static type checking. | >>> T = TypeVar('T') >>> list[T].__parameters__ (~T,)
.. note::
A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not
have correct ``__parameters__`` after substitution because
:class:`typing.ParamSpec` is intended primarily for static type checking. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e7aa86ad-463b-484a-aa25-636b02fd705a | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,002 | supabase-export-v2 | 7f322e658ea1a33a | :class:`queue.PriorityQueue` * :class:`queue.SimpleQueue` * :ref:`re.Pattern <re-objects>` * :ref:`re.Match <match-objects>` * :class:`shelve.BsdDbShelf` * :class:`shelve.DbfilenameShelf` * :class:`shelve.Shelf` * :class:`types.MappingProxyType` * :class:`weakref.WeakKeyDictionary` * :class:`weakref.WeakMethod` * :clas... | trusted_official_docs | CPython Docs | :class:`queue.PriorityQueue` * :class:`queue.SimpleQueue` * :ref:`re.Pattern <re-objects>` * :ref:`re.Match <match-objects>` * :class:`shelve.BsdDbShelf` * :class:`shelve.DbfilenameShelf` * :class:`shelve.Shelf` * :class:`types.MappingProxyType` * :class:`weakref.WeakKeyDictionary` * :class:`weakref.WeakMethod` * :clas... | :class:`queue.PriorityQueue` * :class:`queue.SimpleQueue` * :ref:`re.Pattern <re-objects>` * :ref:`re.Match <match-objects>` * :class:`shelve.BsdDbShelf` * :class:`shelve.DbfilenameShelf` * :class:`shelve.Shelf` * :class:`types.MappingProxyType` * :class:`weakref.WeakKeyDictionary` * :class:`weakref.WeakMethod` * :clas... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e7d684f4-0098-4bdf-857a-bd9becf354a0 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,921 | supabase-export-v2 | c8708e36f5330123 | Return an iterator over the keys, values or items (represented as tuples of ``(key, value)``) in the dictionary.
Keys and values are iterated over in insertion order. This allows the creation of ``(value, key)`` pairs
using :func:`zip`: ``pairs = zip(d.values(), d.keys())``. Another way to
create the same list is ``p... | trusted_official_docs | CPython Docs | Return an iterator over the keys, values or items (represented as tuples of ``(key, value)``) in the dictionary.
Keys and values are iterated over in insertion order. This allows the creation of ``(value, key)`` pairs
using :func:`zip`: ``pairs = zip(d.values(), d.keys())``. Another way to
create the same list is ``p... | Return an iterator over the keys, values or items (represented as tuples of ``(key, value)``) in the dictionary.
Keys and values are iterated over in insertion order. This allows the creation of ``(value, key)`` pairs
using :func:`zip`: ``pairs = zip(d.values(), d.keys())``. Another way to
create the same list is ``p... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e960b5fd-009b-485d-8ea8-754fa30bd6d8 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,106 | supabase-export-v2 | 693395641e98b369 | The NotImplemented Object -------------------------
This object is returned from comparisons and binary operations when they are
asked to operate on types they don't support. See :ref:`comparisons` for more
information. There is exactly one :data:`NotImplemented` object. :code:`type(NotImplemented)()` produces the sing... | trusted_official_docs | CPython Docs | The NotImplemented Object -------------------------
This object is returned from comparisons and binary operations when they are
asked to operate on types they don't support. See :ref:`comparisons` for more
information. There is exactly one :data:`NotImplemented` object. :code:`type(NotImplemented)()` produces the sing... | The NotImplemented Object -------------------------
This object is returned from comparisons and binary operations when they are
asked to operate on types they don't support. See :ref:`comparisons` for more
information. There is exactly one :data:`NotImplemented` object. :code:`type(NotImplemented)()` produces the sing... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ea7e1657-5ba7-4e0f-a458-37c473ebdee3 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,154 | supabase-export-v2 | 291c97fabf2779b7 | Recommended configuration -------------------------
The default :data:`sys.int_info.default_max_str_digits` is expected to be
reasonable for most applications. If your application requires a different
limit, set it from your main entry point using Python version agnostic code as
these APIs were added in security patch ... | trusted_official_docs | CPython Docs | Recommended configuration -------------------------
The default :data:`sys.int_info.default_max_str_digits` is expected to be
reasonable for most applications. If your application requires a different
limit, set it from your main entry point using Python version agnostic code as
these APIs were added in security patch ... | Recommended configuration -------------------------
The default :data:`sys.int_info.default_max_str_digits` is expected to be
reasonable for most applications. If your application requires a different
limit, set it from your main entry point using Python version agnostic code as
these APIs were added in security patch ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eb952fdc-237c-459a-a097-11070bbfa92d | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,045 | supabase-export-v2 | 2cf6c5faa7d3588b | However, :ref:`parameterized generics <types-genericalias>` in union objects cannot be checked::
>>> isinstance(1, int | list[int]) # short-circuit evaluation
True
>>> isinstance([1], int | list[int])
Traceback (most recent call last):
... TypeError: isinstance() argument 2 cannot be a parameterized generic | trusted_official_docs | CPython Docs | However, :ref:`parameterized generics <types-genericalias>` in union objects cannot be checked::
>>> isinstance(1, int | list[int]) # short-circuit evaluation
True
>>> isinstance([1], int | list[int])
Traceback (most recent call last):
... TypeError: isinstance() argument 2 cannot be a parameterized generic | However, :ref:`parameterized generics <types-genericalias>` in union objects cannot be checked::
>>> isinstance(1, int | list[int]) # short-circuit evaluation
True
>>> isinstance([1], int | list[int])
Traceback (most recent call last):
... TypeError: isinstance() argument 2 cannot be a parameterized generic | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eb9cc45c-abe3-4a67-b74c-90f074dab0a7 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,845 | supabase-export-v2 | 1378bf68e1360acd | '>=', '>') raise :exc:`TypeError`. To illustrate dictionary creation and equality, the following examples all return a dictionary equal to ``{"one": 1, "two": 2, "three": 3}``::
>>> a = dict(one=1, two=2, three=3)
>>> b = {'one': 1, 'two': 2, 'three': 3}
>>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))
>>> d = ... | trusted_official_docs | CPython Docs | '>=', '>') raise :exc:`TypeError`. To illustrate dictionary creation and equality, the following examples all return a dictionary equal to ``{"one": 1, "two": 2, "three": 3}``::
>>> a = dict(one=1, two=2, three=3)
>>> b = {'one': 1, 'two': 2, 'three': 3}
>>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))
>>> d = ... | '>=', '>') raise :exc:`TypeError`. To illustrate dictionary creation and equality, the following examples all return a dictionary equal to ``{"one": 1, "two": 2, "three": 3}``::
>>> a = dict(one=1, two=2, three=3)
>>> b = {'one': 1, 'two': 2, 'three': 3}
>>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))
>>> d = ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ebdefa20-80e6-44f1-aec4-93fdee5c368f | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,959 | supabase-export-v2 | 8fd7c83a0ee26dbf | occurred while executing the body of the :keyword:`with` statement, the arguments contain the exception type, value and traceback information. Otherwise, all three arguments are ``None``.
Returning a true value from this method will cause the :keyword:`with` statement
to suppress the exception and continue execution w... | trusted_official_docs | CPython Docs | occurred while executing the body of the :keyword:`with` statement, the arguments contain the exception type, value and traceback information. Otherwise, all three arguments are ``None``.
Returning a true value from this method will cause the :keyword:`with` statement
to suppress the exception and continue execution w... | occurred while executing the body of the :keyword:`with` statement, the arguments contain the exception type, value and traceback information. Otherwise, all three arguments are ``None``.
Returning a true value from this method will cause the :keyword:`with` statement
to suppress the exception and continue execution w... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ec1c44d0-573e-4fcc-a482-4e271b131d57 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,932 | supabase-export-v2 | 97332fa1e8aa98b0 | .. versionadded:: 3.10
Keys views are set-like since their entries are unique and :term:`hashable`. Items views also have set-like operations since the (key, value) pairs
are unique and the keys are hashable. If all values in an items view are hashable as well,
then the items view can interoperate with other sets. (Val... | trusted_official_docs | CPython Docs | .. versionadded:: 3.10
Keys views are set-like since their entries are unique and :term:`hashable`. Items views also have set-like operations since the (key, value) pairs
are unique and the keys are hashable. If all values in an items view are hashable as well,
then the items view can interoperate with other sets. (Val... | .. versionadded:: 3.10
Keys views are set-like since their entries are unique and :term:`hashable`. Items views also have set-like operations since the (key, value) pairs
are unique and the keys are hashable. If all values in an items view are hashable as well,
then the items view can interoperate with other sets. (Val... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ef86c9b2-eb8b-4557-ab0a-c6eeab33654b | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,935 | supabase-export-v2 | b4d00c9746f09ebb | >>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500} >>> keys = dishes.keys() >>> values = dishes.values()
>>> # iteration
>>> n = 0
>>> for val in values:
... n += val
... >>> print(n)
504 | trusted_official_docs | CPython Docs | >>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500} >>> keys = dishes.keys() >>> values = dishes.values()
>>> # iteration
>>> n = 0
>>> for val in values:
... n += val
... >>> print(n)
504 | >>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500} >>> keys = dishes.keys() >>> values = dishes.values()
>>> # iteration
>>> n = 0
>>> for val in values:
... n += val
... >>> print(n)
504 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f2025bf8-1046-4fba-9dc2-933427bbca5b | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,988 | supabase-export-v2 | 6a2d5720a4ed682d | a ``GenericAlias``, the elements in the container are not checked against their type. For example, the following code is discouraged, but will run without errors::
>>> t = list[str]
>>> t([1, 2, 3])
[1, 2, 3] | trusted_official_docs | CPython Docs | a ``GenericAlias``, the elements in the container are not checked against their type. For example, the following code is discouraged, but will run without errors::
>>> t = list[str]
>>> t([1, 2, 3])
[1, 2, 3] | a ``GenericAlias``, the elements in the container are not checked against their type. For example, the following code is discouraged, but will run without errors::
>>> t = list[str]
>>> t([1, 2, 3])
[1, 2, 3] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f33bb729-7a8c-4641-be89-ee07d90a5eab | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,029 | supabase-export-v2 | e5b11552532c0c30 | class not yet defined, will fail at runtime. For unions which include forward references, present the whole expression as a string, e.g. ``"int | Foo"``.
.. describe:: union_object == other | trusted_official_docs | CPython Docs | class not yet defined, will fail at runtime. For unions which include forward references, present the whole expression as a string, e.g. ``"int | Foo"``.
.. describe:: union_object == other | class not yet defined, will fail at runtime. For unions which include forward references, present the whole expression as a string, e.g. ``"int | Foo"``.
.. describe:: union_object == other | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f58ed4ef-4ec6-4bd3-babd-6bcde5f29eb1 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,753 | supabase-export-v2 | 3ea5cba72b56c464 | A tuple of integers the length of :attr:`ndim` giving the size in bytes to access each element for each dimension of the array.
.. versionchanged:: 3.3
An empty tuple instead of ``None`` when ndim = 0. | trusted_official_docs | CPython Docs | A tuple of integers the length of :attr:`ndim` giving the size in bytes to access each element for each dimension of the array.
.. versionchanged:: 3.3
An empty tuple instead of ``None`` when ndim = 0. | A tuple of integers the length of :attr:`ndim` giving the size in bytes to access each element for each dimension of the array.
.. versionchanged:: 3.3
An empty tuple instead of ``None`` when ndim = 0. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f6114cba-9225-4f0a-afc6-6266132203c2 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,803 | supabase-export-v2 | 3cc131449c80a3a8 | Return a shallow copy of the set.
Note, the non-operator versions of :meth:`~frozenset.union`,
:meth:`~frozenset.intersection`, :meth:`~frozenset.difference`, :meth:`~frozenset.symmetric_difference`, :meth:`~frozenset.issubset`, and
:meth:`~frozenset.issuperset` methods will accept any iterable as an argument. In
contr... | trusted_official_docs | CPython Docs | Return a shallow copy of the set.
Note, the non-operator versions of :meth:`~frozenset.union`,
:meth:`~frozenset.intersection`, :meth:`~frozenset.difference`, :meth:`~frozenset.symmetric_difference`, :meth:`~frozenset.issubset`, and
:meth:`~frozenset.issuperset` methods will accept any iterable as an argument. In
contr... | Return a shallow copy of the set.
Note, the non-operator versions of :meth:`~frozenset.union`,
:meth:`~frozenset.intersection`, :meth:`~frozenset.difference`, :meth:`~frozenset.symmetric_difference`, :meth:`~frozenset.issubset`, and
:meth:`~frozenset.issuperset` methods will accept any iterable as an argument. In
contr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f6560db8-9f31-494d-8c06-3212d03c8258 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,059 | supabase-export-v2 | 65178b7267a1bc77 | Modules -------
The only special operation on a module is attribute access: ``m.name``, where
*m* is a module and *name* accesses a name defined in *m*'s symbol table. Module attributes can be assigned to. (Note that the :keyword:`import`
statement is not, strictly speaking, an operation on a module object; ``import
fo... | trusted_official_docs | CPython Docs | Modules -------
The only special operation on a module is attribute access: ``m.name``, where
*m* is a module and *name* accesses a name defined in *m*'s symbol table. Module attributes can be assigned to. (Note that the :keyword:`import`
statement is not, strictly speaking, an operation on a module object; ``import
fo... | Modules -------
The only special operation on a module is attribute access: ``m.name``, where
*m* is a module and *name* accesses a name defined in *m*'s symbol table. Module attributes can be assigned to. (Note that the :keyword:`import`
statement is not, strictly speaking, an operation on a module object; ``import
fo... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f71f9b6a-f241-4c7f-a1e1-0187bcdaa65e | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,095 | supabase-export-v2 | 61d76856fa23abf9 | that something is omitted. It supports no special operations. There is exactly one ellipsis object, named :const:`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces the :const:`Ellipsis` singleton.
It is written as ``Ellipsis`` or ``...``. | trusted_official_docs | CPython Docs | that something is omitted. It supports no special operations. There is exactly one ellipsis object, named :const:`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces the :const:`Ellipsis` singleton.
It is written as ``Ellipsis`` or ``...``. | that something is omitted. It supports no special operations. There is exactly one ellipsis object, named :const:`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces the :const:`Ellipsis` singleton.
It is written as ``Ellipsis`` or ``...``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f93a3d78-589d-4333-9ec5-fb63697fe979 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,072 | supabase-export-v2 | 0730904d1b77f1a5 | operates, and :attr:`m.__func__ <method.__func__>` is the function implementing the method. Calling ``m(arg-1, arg-2, ..., arg-n)`` is completely equivalent to calling ``m.__func__(m.__self__, arg-1, arg-2, ..., arg-n)``.
Like :ref:`function objects <user-defined-funcs>`, bound method objects support
getting arbitrary
... | trusted_official_docs | CPython Docs | operates, and :attr:`m.__func__ <method.__func__>` is the function implementing the method. Calling ``m(arg-1, arg-2, ..., arg-n)`` is completely equivalent to calling ``m.__func__(m.__self__, arg-1, arg-2, ..., arg-n)``.
Like :ref:`function objects <user-defined-funcs>`, bound method objects support
getting arbitrary
... | operates, and :attr:`m.__func__ <method.__func__>` is the function implementing the method. Calling ``m(arg-1, arg-2, ..., arg-n)`` is completely equivalent to calling ``m.__func__(m.__self__, arg-1, arg-2, ..., arg-n)``.
Like :ref:`function objects <user-defined-funcs>`, bound method objects support
getting arbitrary
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f9552aa4-a386-43e8-9596-fe70a8cdbb28 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,961 | supabase-export-v2 | b282037499cd0abf | exception while handling an earlier exception from the :keyword:`with` block, the new exception is raised, and the original exception is stored in its :attr:`~BaseException.__context__` attribute.
The exception passed in should never be reraised explicitly - instead, this
method should return a false value to indicate... | trusted_official_docs | CPython Docs | exception while handling an earlier exception from the :keyword:`with` block, the new exception is raised, and the original exception is stored in its :attr:`~BaseException.__context__` attribute.
The exception passed in should never be reraised explicitly - instead, this
method should return a false value to indicate... | exception while handling an earlier exception from the :keyword:`with` block, the new exception is raised, and the original exception is stored in its :attr:`~BaseException.__context__` attribute.
The exception passed in should never be reraised explicitly - instead, this
method should return a false value to indicate... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f9625e7a-5cd2-430d-b0a1-32b5e39a5e58 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,768 | supabase-export-v2 | a78a5a0969cfd3f8 | mathematical operations such as intersection, union, difference, and symmetric difference. (For other containers see the built-in :class:`dict`, :class:`list`, and :class:`tuple` classes, and the :mod:`collections` module.)
Like other collections, sets support ``x in set``, ``len(set)``, and ``for x in
set``. Being an ... | trusted_official_docs | CPython Docs | mathematical operations such as intersection, union, difference, and symmetric difference. (For other containers see the built-in :class:`dict`, :class:`list`, and :class:`tuple` classes, and the :mod:`collections` module.)
Like other collections, sets support ``x in set``, ``len(set)``, and ``for x in
set``. Being an ... | mathematical operations such as intersection, union, difference, and symmetric difference. (For other containers see the built-in :class:`dict`, :class:`list`, and :class:`tuple` classes, and the :mod:`collections` module.)
Like other collections, sets support ``x in set``, ``len(set)``, and ``for x in
set``. Being an ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fb765853-2058-4a0a-b1c4-6389bd87dca8 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 23,848 | supabase-export-v2 | 1f532c3a24bf5046 | Dictionaries preserve insertion order. Note that updating a key does not affect the order. Keys added after deletion are inserted at the end. ::
>>> d = {"one": 1, "two": 2, "three": 3, "four": 4}
>>> d
{'one': 1, 'two': 2, 'three': 3, 'four': 4}
>>> list(d)
['one', 'two', 'three', 'four']
>>> list(d.values())
[1... | trusted_official_docs | CPython Docs | Dictionaries preserve insertion order. Note that updating a key does not affect the order. Keys added after deletion are inserted at the end. ::
>>> d = {"one": 1, "two": 2, "three": 3, "four": 4}
>>> d
{'one': 1, 'two': 2, 'three': 3, 'four': 4}
>>> list(d)
['one', 'two', 'three', 'four']
>>> list(d.values())
[1... | Dictionaries preserve insertion order. Note that updating a key does not affect the order. Keys added after deletion are inserted at the end. ::
>>> d = {"one": 1, "two": 2, "three": 3, "four": 4}
>>> d
{'one': 1, 'two': 2, 'three': 3, 'four': 4}
>>> list(d)
['one', 'two', 'three', 'four']
>>> list(d.values())
[1... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fd8f2385-1384-4c33-aed0-c9e3e19e70d3 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,020 | supabase-export-v2 | 6a1b009bba4c5635 | :pep:`585` - Type Hinting Generics In Standard Collections Introducing the ability to natively parameterize standard-library classes, provided they implement the special class method :meth:`~object.__class_getitem__`.
:ref:`Generics`, :ref:`user-defined generics <user-defined-generics>` and :class:`typing.Generic`
Doc... | trusted_official_docs | CPython Docs | :pep:`585` - Type Hinting Generics In Standard Collections Introducing the ability to natively parameterize standard-library classes, provided they implement the special class method :meth:`~object.__class_getitem__`.
:ref:`Generics`, :ref:`user-defined generics <user-defined-generics>` and :class:`typing.Generic`
Doc... | :pep:`585` - Type Hinting Generics In Standard Collections Introducing the ability to natively parameterize standard-library classes, provided they implement the special class method :meth:`~object.__class_getitem__`.
:ref:`Generics`, :ref:`user-defined generics <user-defined-generics>` and :class:`typing.Generic`
Doc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fdc4c024-c638-4670-a567-45100e462721 | CPython Docs | file://datasets/cpython/Doc/library/stdtypes.rst | unknown | a3cf8bc4-60ee-4147-adb3-d0deb77581ec | 24,142 | supabase-export-v2 | 74612fdcc4d328f1 | The limitations do not apply to functions with a linear algorithm:
* ``int(string, base)`` with base 2, 4, 8, 16, or 32. * :func:`int.from_bytes` and :func:`int.to_bytes`. * :func:`hex`, :func:`oct`, :func:`bin`. * :ref:`formatspec` for hex, octal, and binary numbers. * :class:`str` to :class:`float`. * :class:`str` to... | trusted_official_docs | CPython Docs | The limitations do not apply to functions with a linear algorithm:
* ``int(string, base)`` with base 2, 4, 8, 16, or 32. * :func:`int.from_bytes` and :func:`int.to_bytes`. * :func:`hex`, :func:`oct`, :func:`bin`. * :ref:`formatspec` for hex, octal, and binary numbers. * :class:`str` to :class:`float`. * :class:`str` to... | The limitations do not apply to functions with a linear algorithm:
* ``int(string, base)`` with base 2, 4, 8, 16, or 32. * :func:`int.from_bytes` and :func:`int.to_bytes`. * :func:`hex`, :func:`oct`, :func:`bin`. * :ref:`formatspec` for hex, octal, and binary numbers. * :class:`str` to :class:`float`. * :class:`str` to... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
030ffd29-f06a-4d04-b410-0d531d93dfe9 | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,174 | supabase-export-v2 | 7688728da685a16f | .. class:: Queue(maxsize=0)
Constructor for a :abbr:`FIFO (first-in, first-out)` queue. *maxsize* is
an integer that sets the upperbound
limit on the number of items that can be placed in the queue. Insertion will
block once this size has been reached, until queue items are consumed. If
*maxsize* is less than or eq... | trusted_official_docs | CPython Docs | .. class:: Queue(maxsize=0)
Constructor for a :abbr:`FIFO (first-in, first-out)` queue. *maxsize* is
an integer that sets the upperbound
limit on the number of items that can be placed in the queue. Insertion will
block once this size has been reached, until queue items are consumed. If
*maxsize* is less than or eq... | .. class:: Queue(maxsize=0)
Constructor for a :abbr:`FIFO (first-in, first-out)` queue. *maxsize* is
an integer that sets the upperbound
limit on the number of items that can be placed in the queue. Insertion will
block once this size has been reached, until queue items are consumed. If
*maxsize* is less than or eq... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
07e005aa-a8b6-4336-93ab-b3f4103eb309 | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,205 | supabase-export-v2 | 5178ccb91a0d61b2 | .. method:: Queue.get(block=True, timeout=None)
Remove and return an item from the queue. If optional args *block* is true and
*timeout* is ``None`` (the default), block if necessary until an item is available. If *timeout* is a positive number, it blocks at most *timeout* seconds and
raises the :exc:`Empty` exceptio... | trusted_official_docs | CPython Docs | .. method:: Queue.get(block=True, timeout=None)
Remove and return an item from the queue. If optional args *block* is true and
*timeout* is ``None`` (the default), block if necessary until an item is available. If *timeout* is a positive number, it blocks at most *timeout* seconds and
raises the :exc:`Empty` exceptio... | .. method:: Queue.get(block=True, timeout=None)
Remove and return an item from the queue. If optional args *block* is true and
*timeout* is ``None`` (the default), block if necessary until an item is available. If *timeout* is a positive number, it blocks at most *timeout* seconds and
raises the :exc:`Empty` exceptio... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0829e070-03f9-4374-bd2a-45058d13b1e7 | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,180 | supabase-export-v2 | d29d560397193a5b | lowest valued entry is the one that would be returned by ``min(entries)``). A typical pattern for entries is a tuple in the form: ``(priority_number, data)``.
If the *data* elements are not comparable, the data can be wrapped in a class
that ignores the data item and only compares the priority number:: | trusted_official_docs | CPython Docs | lowest valued entry is the one that would be returned by ``min(entries)``). A typical pattern for entries is a tuple in the form: ``(priority_number, data)``.
If the *data* elements are not comparable, the data can be wrapped in a class
that ignores the data item and only compares the priority number:: | lowest valued entry is the one that would be returned by ``min(entries)``). A typical pattern for entries is a tuple in the form: ``(priority_number, data)``.
If the *data* elements are not comparable, the data can be wrapped in a class
that ignores the data item and only compares the priority number:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0fe38816-3f09-455c-acb2-e462605f6ffc | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,230 | supabase-export-v2 | 684020391b75d833 | longer grow. Future calls to :meth:`~Queue.put` raise :exc:`ShutDown`. Currently blocked callers of :meth:`~Queue.put` will be unblocked and will raise :exc:`ShutDown` in the formerly blocked thread.
If *immediate* is false (the default), the queue can be wound
down normally with :meth:`~Queue.get` calls to extract ta... | trusted_official_docs | CPython Docs | longer grow. Future calls to :meth:`~Queue.put` raise :exc:`ShutDown`. Currently blocked callers of :meth:`~Queue.put` will be unblocked and will raise :exc:`ShutDown` in the formerly blocked thread.
If *immediate* is false (the default), the queue can be wound
down normally with :meth:`~Queue.get` calls to extract ta... | longer grow. Future calls to :meth:`~Queue.put` raise :exc:`ShutDown`. Currently blocked callers of :meth:`~Queue.put` will be unblocked and will raise :exc:`ShutDown` in the formerly blocked thread.
If *immediate* is false (the default), the queue can be wound
down normally with :meth:`~Queue.get` calls to extract ta... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1dc0a68a-34d9-4fe6-baa4-8bc79be3f4be | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,168 | supabase-export-v2 | 05b51387d351a9de | --------------
The :mod:`!queue` module implements multi-producer, multi-consumer queues. It is especially useful in threaded programming when information must be
exchanged safely between multiple threads. The :class:`Queue` class in this
module implements all the required locking semantics. | trusted_official_docs | CPython Docs | --------------
The :mod:`!queue` module implements multi-producer, multi-consumer queues. It is especially useful in threaded programming when information must be
exchanged safely between multiple threads. The :class:`Queue` class in this
module implements all the required locking semantics. | --------------
The :mod:`!queue` module implements multi-producer, multi-consumer queues. It is especially useful in threaded programming when information must be
exchanged safely between multiple threads. The :class:`Queue` class in this
module implements all the required locking semantics. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
237b660e-e43c-4b90-ae69-634c57f0e76d | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,234 | supabase-export-v2 | dac42fa1a69cfc44 | unfinished tasks is zero, callers of :meth:`~Queue.join` are unblocked. Also, blocked callers of :meth:`~Queue.get` are unblocked and will raise :exc:`ShutDown` because the queue is empty.
Use caution when using :meth:`~Queue.join` with *immediate* set
to true. This unblocks the join even when no work has been done
o... | trusted_official_docs | CPython Docs | unfinished tasks is zero, callers of :meth:`~Queue.join` are unblocked. Also, blocked callers of :meth:`~Queue.get` are unblocked and will raise :exc:`ShutDown` because the queue is empty.
Use caution when using :meth:`~Queue.join` with *immediate* set
to true. This unblocks the join even when no work has been done
o... | unfinished tasks is zero, callers of :meth:`~Queue.join` are unblocked. Also, blocked callers of :meth:`~Queue.get` are unblocked and will raise :exc:`ShutDown` because the queue is empty.
Use caution when using :meth:`~Queue.join` with *immediate* set
to true. This unblocks the join even when no work has been done
o... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
25fe2c84-5e34-427f-93b9-8ac96611be34 | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,242 | supabase-export-v2 | efa1825e592f8d05 | Return ``True`` if the queue is empty, ``False`` otherwise. If empty() returns ``False`` it doesn't guarantee that a subsequent call to get() will not block.
.. method:: SimpleQueue.put(item, block=True, timeout=None) | trusted_official_docs | CPython Docs | Return ``True`` if the queue is empty, ``False`` otherwise. If empty() returns ``False`` it doesn't guarantee that a subsequent call to get() will not block.
.. method:: SimpleQueue.put(item, block=True, timeout=None) | Return ``True`` if the queue is empty, ``False`` otherwise. If empty() returns ``False`` it doesn't guarantee that a subsequent call to get() will not block.
.. method:: SimpleQueue.put(item, block=True, timeout=None) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
28995b41-4cca-427b-93ce-f0a5376ba4a3 | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,207 | supabase-export-v2 | 3a0d1305598365a4 | into an uninterruptible wait on an underlying lock. This means that no exceptions can occur, and in particular a SIGINT will not trigger a :exc:`KeyboardInterrupt`.
Raises :exc:`ShutDown` if the queue has been shut down and is empty, or if
the queue has been shut down immediately. | trusted_official_docs | CPython Docs | into an uninterruptible wait on an underlying lock. This means that no exceptions can occur, and in particular a SIGINT will not trigger a :exc:`KeyboardInterrupt`.
Raises :exc:`ShutDown` if the queue has been shut down and is empty, or if
the queue has been shut down immediately. | into an uninterruptible wait on an underlying lock. This means that no exceptions can occur, and in particular a SIGINT will not trigger a :exc:`KeyboardInterrupt`.
Raises :exc:`ShutDown` if the queue has been shut down and is empty, or if
the queue has been shut down immediately. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2da3887a-6b97-471b-b67c-d0d9471f93a8 | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,199 | supabase-export-v2 | d8b012c3204bdc5e | a subsequent call to get() will not block. Similarly, if full() returns ``False`` it doesn't guarantee that a subsequent call to put() will not block.
.. method:: Queue.put(item, block=True, timeout=None) | trusted_official_docs | CPython Docs | a subsequent call to get() will not block. Similarly, if full() returns ``False`` it doesn't guarantee that a subsequent call to put() will not block.
.. method:: Queue.put(item, block=True, timeout=None) | a subsequent call to get() will not block. Similarly, if full() returns ``False`` it doesn't guarantee that a subsequent call to put() will not block.
.. method:: Queue.put(item, block=True, timeout=None) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2e356ea3-6944-4d36-adcd-a70be17e1183 | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,194 | supabase-export-v2 | fc22085a37a329fd | .. method:: Queue.qsize()
Return the approximate size of the queue. Note, qsize() > 0 doesn't
guarantee that a subsequent get() will not block, nor will qsize() < maxsize
guarantee that put() will not block. | trusted_official_docs | CPython Docs | .. method:: Queue.qsize()
Return the approximate size of the queue. Note, qsize() > 0 doesn't
guarantee that a subsequent get() will not block, nor will qsize() < maxsize
guarantee that put() will not block. | .. method:: Queue.qsize()
Return the approximate size of the queue. Note, qsize() > 0 doesn't
guarantee that a subsequent get() will not block, nor will qsize() < maxsize
guarantee that put() will not block. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2fab51a7-5b08-4e46-9a14-cb062b054778 | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,229 | supabase-export-v2 | 6be563b67d2ad8f0 | Put a :class:`Queue` instance into a shutdown mode.
The queue can no longer grow. Future calls to :meth:`~Queue.put` raise :exc:`ShutDown`. Currently blocked callers of :meth:`~Queue.put` will be unblocked
and will raise :exc:`ShutDown` in the formerly blocked thread. | trusted_official_docs | CPython Docs | Put a :class:`Queue` instance into a shutdown mode.
The queue can no longer grow. Future calls to :meth:`~Queue.put` raise :exc:`ShutDown`. Currently blocked callers of :meth:`~Queue.put` will be unblocked
and will raise :exc:`ShutDown` in the formerly blocked thread. | Put a :class:`Queue` instance into a shutdown mode.
The queue can no longer grow. Future calls to :meth:`~Queue.put` raise :exc:`ShutDown`. Currently blocked callers of :meth:`~Queue.put` will be unblocked
and will raise :exc:`ShutDown` in the formerly blocked thread. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
331b72c7-e1ee-433b-a6cb-7ab59fdbf861 | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,217 | supabase-export-v2 | 4abe321c769813bc | Blocks until all items in the queue have been gotten and processed.
The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer thread calls :meth:`task_done` to
indicate that the item was retrieved and all work on it is complete. When the
count of unfinished ... | trusted_official_docs | CPython Docs | Blocks until all items in the queue have been gotten and processed.
The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer thread calls :meth:`task_done` to
indicate that the item was retrieved and all work on it is complete. When the
count of unfinished ... | Blocks until all items in the queue have been gotten and processed.
The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer thread calls :meth:`task_done` to
indicate that the item was retrieved and all work on it is complete. When the
count of unfinished ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
34d85dd6-5657-4647-b769-cc1b4258a65b | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,176 | supabase-export-v2 | ce8e643342da4abf | .. class:: LifoQueue(maxsize=0)
Constructor for a :abbr:`LIFO (last-in, first-out)` queue. *maxsize* is
an integer that sets the upperbound
limit on the number of items that can be placed in the queue. Insertion will
block once this size has been reached, until queue items are consumed. If
*maxsize* is less than or... | trusted_official_docs | CPython Docs | .. class:: LifoQueue(maxsize=0)
Constructor for a :abbr:`LIFO (last-in, first-out)` queue. *maxsize* is
an integer that sets the upperbound
limit on the number of items that can be placed in the queue. Insertion will
block once this size has been reached, until queue items are consumed. If
*maxsize* is less than or... | .. class:: LifoQueue(maxsize=0)
Constructor for a :abbr:`LIFO (last-in, first-out)` queue. *maxsize* is
an integer that sets the upperbound
limit on the number of items that can be placed in the queue. Insertion will
block once this size has been reached, until queue items are consumed. If
*maxsize* is less than or... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3aa7009e-a3e3-4e9d-ab44-dffa5fe7b559 | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,169 | supabase-export-v2 | 9a0b762621438b99 | useful in threaded programming when information must be exchanged safely between multiple threads. The :class:`Queue` class in this module implements all the required locking semantics.
The module implements three types of queue, which differ only in the order in
which the entries are retrieved. In a :abbr:`FIFO (first... | trusted_official_docs | CPython Docs | useful in threaded programming when information must be exchanged safely between multiple threads. The :class:`Queue` class in this module implements all the required locking semantics.
The module implements three types of queue, which differ only in the order in
which the entries are retrieved. In a :abbr:`FIFO (first... | useful in threaded programming when information must be exchanged safely between multiple threads. The :class:`Queue` class in this module implements all the required locking semantics.
The module implements three types of queue, which differ only in the order in
which the entries are retrieved. In a :abbr:`FIFO (first... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3d7a9a68-b7a3-496a-8347-2714520874a5 | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,212 | supabase-export-v2 | 437157e093f79bee | .. method:: Queue.task_done()
Indicate that a formerly enqueued task is complete. Used by queue consumer
threads. For each :meth:`get` used to fetch a task, a subsequent call to
:meth:`task_done` tells the queue that the processing on the task is complete. | trusted_official_docs | CPython Docs | .. method:: Queue.task_done()
Indicate that a formerly enqueued task is complete. Used by queue consumer
threads. For each :meth:`get` used to fetch a task, a subsequent call to
:meth:`task_done` tells the queue that the processing on the task is complete. | .. method:: Queue.task_done()
Indicate that a formerly enqueued task is complete. Used by queue consumer
threads. For each :meth:`get` used to fetch a task, a subsequent call to
:meth:`task_done` tells the queue that the processing on the task is complete. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
414122f3-30d4-4c20-a77b-389c435e2123 | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,181 | supabase-export-v2 | a3a0a81799fb0d20 | the *data* elements are not comparable, the data can be wrapped in a class that ignores the data item and only compares the priority number::
from dataclasses import dataclass, field
from typing import Any | trusted_official_docs | CPython Docs | the *data* elements are not comparable, the data can be wrapped in a class that ignores the data item and only compares the priority number::
from dataclasses import dataclass, field
from typing import Any | the *data* elements are not comparable, the data can be wrapped in a class that ignores the data item and only compares the priority number::
from dataclasses import dataclass, field
from typing import Any | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
497ace1c-f7c1-461f-96c8-21d260cc5765 | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,178 | supabase-export-v2 | b62568750af59f5f | .. class:: PriorityQueue(maxsize=0)
Constructor for a priority queue. *maxsize* is an integer that sets the upperbound
limit on the number of items that can be placed in the queue. Insertion will
block once this size has been reached, until queue items are consumed. If
*maxsize* is less than or equal to zero, the qu... | trusted_official_docs | CPython Docs | .. class:: PriorityQueue(maxsize=0)
Constructor for a priority queue. *maxsize* is an integer that sets the upperbound
limit on the number of items that can be placed in the queue. Insertion will
block once this size has been reached, until queue items are consumed. If
*maxsize* is less than or equal to zero, the qu... | .. class:: PriorityQueue(maxsize=0)
Constructor for a priority queue. *maxsize* is an integer that sets the upperbound
limit on the number of items that can be placed in the queue. Insertion will
block once this size has been reached, until queue items are consumed. If
*maxsize* is less than or equal to zero, the qu... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4b080218-dcb9-459b-982c-264ceee0600d | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,171 | supabase-export-v2 | 0a03f231613e71e8 | Internally, those three types of queues use locks to temporarily block competing threads; however, they are not designed to handle reentrancy within a thread.
In addition, the module implements a "simple"
:abbr:`FIFO (first-in, first-out)` queue type, :class:`SimpleQueue`, whose
specific implementation provides additio... | trusted_official_docs | CPython Docs | Internally, those three types of queues use locks to temporarily block competing threads; however, they are not designed to handle reentrancy within a thread.
In addition, the module implements a "simple"
:abbr:`FIFO (first-in, first-out)` queue type, :class:`SimpleQueue`, whose
specific implementation provides additio... | Internally, those three types of queues use locks to temporarily block competing threads; however, they are not designed to handle reentrancy within a thread.
In addition, the module implements a "simple"
:abbr:`FIFO (first-in, first-out)` queue type, :class:`SimpleQueue`, whose
specific implementation provides additio... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
56787deb-5c6f-4a6b-a974-b116827d5577 | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,201 | supabase-export-v2 | 51603c3c00a34ef0 | false), put an item on the queue if a free slot is immediately available, else raise the :exc:`Full` exception (*timeout* is ignored in that case).
Raises :exc:`ShutDown` if the queue has been shut down. | trusted_official_docs | CPython Docs | false), put an item on the queue if a free slot is immediately available, else raise the :exc:`Full` exception (*timeout* is ignored in that case).
Raises :exc:`ShutDown` if the queue has been shut down. | false), put an item on the queue if a free slot is immediately available, else raise the :exc:`Full` exception (*timeout* is ignored in that case).
Raises :exc:`ShutDown` if the queue has been shut down. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
584bad36-d973-4861-8e10-e42610a62bcc | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,233 | supabase-export-v2 | 6d75659bed9a5ee8 | Once the queue is empty, future calls to :meth:`~Queue.get` will raise :exc:`ShutDown`.
If *immediate* is true, the queue is terminated immediately. The queue is drained to be completely empty and the count
of unfinished tasks is reduced by the number of tasks drained. If unfinished tasks is zero, callers of :meth:`~Q... | trusted_official_docs | CPython Docs | Once the queue is empty, future calls to :meth:`~Queue.get` will raise :exc:`ShutDown`.
If *immediate* is true, the queue is terminated immediately. The queue is drained to be completely empty and the count
of unfinished tasks is reduced by the number of tasks drained. If unfinished tasks is zero, callers of :meth:`~Q... | Once the queue is empty, future calls to :meth:`~Queue.get` will raise :exc:`ShutDown`.
If *immediate* is true, the queue is terminated immediately. The queue is drained to be completely empty and the count
of unfinished tasks is reduced by the number of tasks drained. If unfinished tasks is zero, callers of :meth:`~Q... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5b1f33f9-c6be-4adf-b3df-1387b2f9296a | CPython Docs | file://datasets/cpython/Doc/library/queue.rst | unknown | 06ce5e6d-dff0-4a4d-9bc2-27ed7fe64dac | 24,218 | supabase-export-v2 | fcb7acce7e45f22b | to indicate that the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, :meth:`join` unblocks.
Waiting for task completion
^^^^^^^^^^^^^^^^^^^^^^^^^^^ | trusted_official_docs | CPython Docs | to indicate that the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, :meth:`join` unblocks.
Waiting for task completion
^^^^^^^^^^^^^^^^^^^^^^^^^^^ | to indicate that the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, :meth:`join` unblocks.
Waiting for task completion
^^^^^^^^^^^^^^^^^^^^^^^^^^^ | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.