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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3ff79eb0-e459-43f8-88ee-037fc67fd6ff | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,446 | supabase-export-v2 | c9af7341326e98e2 | elem in s # set.__contains__
This operation may compare elements using :meth:`~object.__eq__`, which can
execute arbitrary Python code. During such comparisons, the set may be
modified by another thread. For built-in types like :class:`str`,
:class:`int`, and :class:`float`, :meth:`!__eq__` does not release the
underly... | trusted_official_docs | CPython Docs | elem in s # set.__contains__
This operation may compare elements using :meth:`~object.__eq__`, which can
execute arbitrary Python code. During such comparisons, the set may be
modified by another thread. For built-in types like :class:`str`,
:class:`int`, and :class:`float`, :meth:`!__eq__` does not release the
underly... | elem in s # set.__contains__
This operation may compare elements using :meth:`~object.__eq__`, which can
execute arbitrary Python code. During such comparisons, the set may be
modified by another thread. For built-in types like :class:`str`,
:class:`int`, and :class:`float`, :meth:`!__eq__` does not release the
underly... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
418db8ff-d6a8-47d4-9b90-98c06a2d228f | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,513 | supabase-export-v2 | 54780f26269a6ca9 | with lock: view[0:500] = b'x' * 500
Resizing or reallocating the underlying object (such as calling
:meth:`bytearray.resize`) while a memoryview is exported raises
:exc:`BufferError`. This is enforced regardless of threading. | trusted_official_docs | CPython Docs | with lock: view[0:500] = b'x' * 500
Resizing or reallocating the underlying object (such as calling
:meth:`bytearray.resize`) while a memoryview is exported raises
:exc:`BufferError`. This is enforced regardless of threading. | with lock: view[0:500] = b'x' * 500
Resizing or reallocating the underlying object (such as calling
:meth:`bytearray.resize`) while a memoryview is exported raises
:exc:`BufferError`. This is enforced regardless of threading. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4253dbd2-7814-486f-8c3c-66f13d9130dd | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,389 | supabase-export-v2 | 6885ac7bcf50b039 | The :meth:`~list.clear` method is also :term:`atomic <atomic operation>`. Other threads cannot observe elements being removed.
The :meth:`~list.sort` method is not :term:`atomic <atomic operation>`. Other threads cannot observe intermediate states during sorting, but the
list appears empty for the duration of the sort. | trusted_official_docs | CPython Docs | The :meth:`~list.clear` method is also :term:`atomic <atomic operation>`. Other threads cannot observe elements being removed.
The :meth:`~list.sort` method is not :term:`atomic <atomic operation>`. Other threads cannot observe intermediate states during sorting, but the
list appears empty for the duration of the sort. | The :meth:`~list.clear` method is also :term:`atomic <atomic operation>`. Other threads cannot observe elements being removed.
The :meth:`~list.sort` method is not :term:`atomic <atomic operation>`. Other threads cannot observe intermediate states during sorting, but the
list appears empty for the duration of the sort. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4307179c-0abc-4207-abc2-5a5020c984e6 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,453 | supabase-export-v2 | 7e332239ae35b6e5 | The :meth:`~set.copy` method returns a new object and holds the per-object lock for the duration so that it is always atomic.
The :meth:`~set.clear` method holds the lock for its duration. Other
threads cannot observe elements being removed. | trusted_official_docs | CPython Docs | The :meth:`~set.copy` method returns a new object and holds the per-object lock for the duration so that it is always atomic.
The :meth:`~set.clear` method holds the lock for its duration. Other
threads cannot observe elements being removed. | The :meth:`~set.copy` method returns a new object and holds the per-object lock for the duration so that it is always atomic.
The :meth:`~set.clear` method holds the lock for its duration. Other
threads cannot observe elements being removed. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4364024d-886e-4567-b95d-a577ac0dc69c | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,457 | supabase-export-v2 | 4ead3c2feaa19953 | set/frozenset s | other # other must be set/frozenset s - other # other must be set/frozenset s ^ other # other must be set/frozenset
:meth:`set.update`, :meth:`set.union`, :meth:`set.intersection` and
:meth:`set.difference` can take multiple iterables as arguments. They all
iterate through all the passed iterables and... | trusted_official_docs | CPython Docs | set/frozenset s | other # other must be set/frozenset s - other # other must be set/frozenset s ^ other # other must be set/frozenset
:meth:`set.update`, :meth:`set.union`, :meth:`set.intersection` and
:meth:`set.difference` can take multiple iterables as arguments. They all
iterate through all the passed iterables and... | set/frozenset s | other # other must be set/frozenset s - other # other must be set/frozenset s ^ other # other must be set/frozenset
:meth:`set.update`, :meth:`set.union`, :meth:`set.intersection` and
:meth:`set.difference` can take multiple iterables as arguments. They all
iterate through all the passed iterables and... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
43cbaaca-e140-4957-a9af-cb97f853dfff | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,388 | supabase-export-v2 | 68c95326352d0c02 | lst.append(x) # append to the end of the list, no shifting required lst.pop() # pop element from the end of the list, no shifting required
The :meth:`~list.clear` method is also :term:`atomic <atomic operation>`. Other threads cannot observe elements being removed. | trusted_official_docs | CPython Docs | lst.append(x) # append to the end of the list, no shifting required lst.pop() # pop element from the end of the list, no shifting required
The :meth:`~list.clear` method is also :term:`atomic <atomic operation>`. Other threads cannot observe elements being removed. | lst.append(x) # append to the end of the list, no shifting required lst.pop() # pop element from the end of the list, no shifting required
The :meth:`~list.clear` method is also :term:`atomic <atomic operation>`. Other threads cannot observe elements being removed. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4928e2b1-be9d-4dce-8bad-59de3068f7a7 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,390 | supabase-export-v2 | 09e5ceee6195f77c | method is not :term:`atomic <atomic operation>`. Other threads cannot observe intermediate states during sorting, but the list appears empty for the duration of the sort.
The following operations may allow :term:`lock-free` operations to observe
intermediate states since they modify multiple elements in place: | trusted_official_docs | CPython Docs | method is not :term:`atomic <atomic operation>`. Other threads cannot observe intermediate states during sorting, but the list appears empty for the duration of the sort.
The following operations may allow :term:`lock-free` operations to observe
intermediate states since they modify multiple elements in place: | method is not :term:`atomic <atomic operation>`. Other threads cannot observe intermediate states during sorting, but the list appears empty for the duration of the sort.
The following operations may allow :term:`lock-free` operations to observe
intermediate states since they modify multiple elements in place: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4a11f81e-2f0c-41cd-ba37-45a95ddac6f1 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,456 | supabase-export-v2 | 99b0dc9a0e44848f | .. code-block:: :class: good
s |= other # other must be set/frozenset
s &= other # other must be set/frozenset
s -= other # other must be set/frozenset
s ^= other # other must be set/frozenset
s & other # other must be set/frozenset
s | other # other must be set/frozenset
s - other # other must be set/frozenset
... | trusted_official_docs | CPython Docs | .. code-block:: :class: good
s |= other # other must be set/frozenset
s &= other # other must be set/frozenset
s -= other # other must be set/frozenset
s ^= other # other must be set/frozenset
s & other # other must be set/frozenset
s | other # other must be set/frozenset
s - other # other must be set/frozenset
... | .. code-block:: :class: good
s |= other # other must be set/frozenset
s &= other # other must be set/frozenset
s -= other # other must be set/frozenset
s ^= other # other must be set/frozenset
s & other # other must be set/frozenset
s | other # other must be set/frozenset
s - other # other must be set/frozenset
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4fbbe4d0-b1d4-4ee1-b1ee-abdc14dca2a2 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,393 | supabase-export-v2 | f003c48af44863af | lst.insert(idx, item) # shifts elements lst.pop(idx) # idx not at the end of the list, shifts elements lst *= x # copies elements in place
The :meth:`~list.remove` method may allow concurrent modifications since
element comparison may execute arbitrary Python code (via
:meth:`~object.__eq__`). | trusted_official_docs | CPython Docs | lst.insert(idx, item) # shifts elements lst.pop(idx) # idx not at the end of the list, shifts elements lst *= x # copies elements in place
The :meth:`~list.remove` method may allow concurrent modifications since
element comparison may execute arbitrary Python code (via
:meth:`~object.__eq__`). | lst.insert(idx, item) # shifts elements lst.pop(idx) # idx not at the end of the list, shifts elements lst *= x # copies elements in place
The :meth:`~list.remove` method may allow concurrent modifications since
element comparison may execute arbitrary Python code (via
:meth:`~object.__eq__`). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
53154bd7-dc90-46c5-9ee9-a4608fe90177 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,424 | supabase-export-v2 | 0b4320411680f569 | dict.fromkeys(a_dict) # locks both dict.fromkeys(a_set) # locks both dict.fromkeys(a_frozenset) # locks both
When updating from a non-dict iterable, only the target dictionary is
locked. The iterable may be concurrently modified by another thread: | trusted_official_docs | CPython Docs | dict.fromkeys(a_dict) # locks both dict.fromkeys(a_set) # locks both dict.fromkeys(a_frozenset) # locks both
When updating from a non-dict iterable, only the target dictionary is
locked. The iterable may be concurrently modified by another thread: | dict.fromkeys(a_dict) # locks both dict.fromkeys(a_set) # locks both dict.fromkeys(a_frozenset) # locks both
When updating from a non-dict iterable, only the target dictionary is
locked. The iterable may be concurrently modified by another thread: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
54c199b3-b3e6-4f5a-a33d-af335b9b025b | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,385 | supabase-export-v2 | 959136de22da0a8b | into a new list x * lst # repeats lst x times into a new list lst.copy() # returns a shallow copy of the list
The following methods that only operate on a single element with no shifting
required are :term:`atomic <atomic operation>`: | trusted_official_docs | CPython Docs | into a new list x * lst # repeats lst x times into a new list lst.copy() # returns a shallow copy of the list
The following methods that only operate on a single element with no shifting
required are :term:`atomic <atomic operation>`: | into a new list x * lst # repeats lst x times into a new list lst.copy() # returns a shallow copy of the list
The following methods that only operate on a single element with no shifting
required are :term:`atomic <atomic operation>`: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5988d478-8f95-48e0-a278-f4c984bcaa66 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,347 | supabase-export-v2 | e410ff224b76da1b | ************************ Thread Safety Guarantees ************************
This page documents thread-safety guarantees for built-in types in Python's
free-threaded build. The guarantees described here apply when using Python with
the :term:`GIL` disabled (free-threaded mode). When the GIL is enabled, most
operations a... | trusted_official_docs | CPython Docs | ************************ Thread Safety Guarantees ************************
This page documents thread-safety guarantees for built-in types in Python's
free-threaded build. The guarantees described here apply when using Python with
the :term:`GIL` disabled (free-threaded mode). When the GIL is enabled, most
operations a... | ************************ Thread Safety Guarantees ************************
This page documents thread-safety guarantees for built-in types in Python's
free-threaded build. The guarantees described here apply when using Python with
the :term:`GIL` disabled (free-threaded mode). When the GIL is enabled, most
operations a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5a8363e2-9134-4266-8623-a172530211dd | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,405 | supabase-export-v2 | 0debe5f4e0a8cc1d | is a :class:`dict` or a :class:`tuple`. When using the :meth:`dict.fromkeys` method, dictionary creation is atomic when the argument is a :class:`dict`, :class:`tuple`, :class:`set` or :class:`frozenset`.
The following operations and functions are :term:`lock-free` and
:term:`atomic <atomic operation>`. | trusted_official_docs | CPython Docs | is a :class:`dict` or a :class:`tuple`. When using the :meth:`dict.fromkeys` method, dictionary creation is atomic when the argument is a :class:`dict`, :class:`tuple`, :class:`set` or :class:`frozenset`.
The following operations and functions are :term:`lock-free` and
:term:`atomic <atomic operation>`. | is a :class:`dict` or a :class:`tuple`. When using the :meth:`dict.fromkeys` method, dictionary creation is atomic when the argument is a :class:`dict`, :class:`tuple`, :class:`set` or :class:`frozenset`.
The following operations and functions are :term:`lock-free` and
:term:`atomic <atomic operation>`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5a89b59a-5896-41ed-b4ee-fdb3f7460fcf | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,376 | supabase-export-v2 | a5cc71418297b5d5 | lst[i] # list.__getitem__
The following methods traverse the list and use :term:`atomic <atomic operation>`
reads of each item to perform their function. That means that they may
return results affected by concurrent modifications: | trusted_official_docs | CPython Docs | lst[i] # list.__getitem__
The following methods traverse the list and use :term:`atomic <atomic operation>`
reads of each item to perform their function. That means that they may
return results affected by concurrent modifications: | lst[i] # list.__getitem__
The following methods traverse the list and use :term:`atomic <atomic operation>`
reads of each item to perform their function. That means that they may
return results affected by concurrent modifications: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5e992fc6-397e-4748-b2e3-1a9c49f5f89f | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,419 | supabase-export-v2 | bf9d59bc64356de5 | .. code-block:: :class: good
d.update(other_dict) # both locked when other_dict is a dict
d |= other_dict # both locked when other_dict is a dict
d == other_dict # both locked for dict and subclasses | trusted_official_docs | CPython Docs | .. code-block:: :class: good
d.update(other_dict) # both locked when other_dict is a dict
d |= other_dict # both locked when other_dict is a dict
d == other_dict # both locked for dict and subclasses | .. code-block:: :class: good
d.update(other_dict) # both locked when other_dict is a dict
d |= other_dict # both locked when other_dict is a dict
d == other_dict # both locked for dict and subclasses | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5ef234ef-f534-417a-a782-19f0f1672d02 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,359 | supabase-export-v2 | 7f8ae405c07d94e4 | holding a :term:`lock` for the duration of each call. Without such synchronization, concurrent calls may produce :term:`race conditions <race condition>` or :term:`data races <data race>`.
Example: a function that reads from or writes to an object whose internal
state is not protected by a lock. Callers must ensure tha... | trusted_official_docs | CPython Docs | holding a :term:`lock` for the duration of each call. Without such synchronization, concurrent calls may produce :term:`race conditions <race condition>` or :term:`data races <data race>`.
Example: a function that reads from or writes to an object whose internal
state is not protected by a lock. Callers must ensure tha... | holding a :term:`lock` for the duration of each call. Without such synchronization, concurrent calls may produce :term:`race conditions <race condition>` or :term:`data races <data race>`.
Example: a function that reads from or writes to an object whose internal
state is not protected by a lock. Callers must ensure tha... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
62d06af4-4685-419d-a5b2-3d11c48106a9 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,366 | supabase-export-v2 | 75176c4e98307cdb | Safe on shared objects ----------------------
A function or operation that is safe for concurrent use on the **same**
object. The implementation uses internal synchronization (such as
:term:`per-object locks <per-object lock>` or
:ref:`critical sections <python-critical-section-api>`) to protect shared
mutable state, s... | trusted_official_docs | CPython Docs | Safe on shared objects ----------------------
A function or operation that is safe for concurrent use on the **same**
object. The implementation uses internal synchronization (such as
:term:`per-object locks <per-object lock>` or
:ref:`critical sections <python-critical-section-api>`) to protect shared
mutable state, s... | Safe on shared objects ----------------------
A function or operation that is safe for concurrent use on the **same**
object. The implementation uses internal synchronization (such as
:term:`per-object locks <per-object lock>` or
:ref:`critical sections <python-critical-section-api>`) to protect shared
mutable state, s... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6a926e1d-8e43-4392-9cf9-eb5b5cc314d9 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,351 | supabase-export-v2 | f98027f20d5890df | Thread safety levels ====================
The C API documentation uses the following levels to describe the thread
safety guarantees of each function. The levels are listed from least to
most safe. | trusted_official_docs | CPython Docs | Thread safety levels ====================
The C API documentation uses the following levels to describe the thread
safety guarantees of each function. The levels are listed from least to
most safe. | Thread safety levels ====================
The C API documentation uses the following levels to describe the thread
safety guarantees of each function. The levels are listed from least to
most safe. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6b6ce095-b340-4e68-8b0e-643efde48cd2 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,416 | supabase-export-v2 | d10b3c9218909a7c | dict d.keys() # returns a new dict_keys view object d.values() # returns a new dict_values view object d.items() # returns a new dict_items view object
The :meth:`~dict.clear` method holds the lock for its duration. Other
threads cannot observe elements being removed. | trusted_official_docs | CPython Docs | dict d.keys() # returns a new dict_keys view object d.values() # returns a new dict_values view object d.items() # returns a new dict_items view object
The :meth:`~dict.clear` method holds the lock for its duration. Other
threads cannot observe elements being removed. | dict d.keys() # returns a new dict_keys view object d.values() # returns a new dict_values view object d.items() # returns a new dict_items view object
The :meth:`~dict.clear` method holds the lock for its duration. Other
threads cannot observe elements being removed. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7072e9a6-46ff-498d-9eba-cbd1d96af53f | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,384 | supabase-export-v2 | caf4d7658e43b5b5 | .. code-block:: :class: good
lst1 + lst2 # concatenates two lists into a new list
x * lst # repeats lst x times into a new list
lst.copy() # returns a shallow copy of the list | trusted_official_docs | CPython Docs | .. code-block:: :class: good
lst1 + lst2 # concatenates two lists into a new list
x * lst # repeats lst x times into a new list
lst.copy() # returns a shallow copy of the list | .. code-block:: :class: good
lst1 + lst2 # concatenates two lists into a new list
x * lst # repeats lst x times into a new list
lst.copy() # returns a shallow copy of the list | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7262b229-382c-4b55-abe4-86ce61d7c564 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,454 | supabase-export-v2 | a2b535830a379dda | The :meth:`~set.clear` method holds the lock for its duration. Other threads cannot observe elements being removed.
The following operations only accept :class:`set` or :class:`frozenset`
as operands and always lock both objects: | trusted_official_docs | CPython Docs | The :meth:`~set.clear` method holds the lock for its duration. Other threads cannot observe elements being removed.
The following operations only accept :class:`set` or :class:`frozenset`
as operands and always lock both objects: | The :meth:`~set.clear` method holds the lock for its duration. Other threads cannot observe elements being removed.
The following operations only accept :class:`set` or :class:`frozenset`
as operands and always lock both objects: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
75894d9c-8424-420d-a6ba-07d307f63813 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,362 | supabase-export-v2 | 917af097f26e12b8 | Safe on distinct objects ------------------------
A function or operation that is safe to call from multiple threads without
external synchronization, as long as each thread operates on a **different**
object. Two threads may call the function at the same time, but they must
not pass the same object (or objects that sh... | trusted_official_docs | CPython Docs | Safe on distinct objects ------------------------
A function or operation that is safe to call from multiple threads without
external synchronization, as long as each thread operates on a **different**
object. Two threads may call the function at the same time, but they must
not pass the same object (or objects that sh... | Safe on distinct objects ------------------------
A function or operation that is safe to call from multiple threads without
external synchronization, as long as each thread operates on a **different**
object. Two threads may call the function at the same time, but they must
not pass the same object (or objects that sh... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
79f0f059-4808-4163-aa1e-319ba43608d9 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,493 | supabase-export-v2 | 3cce19a522e0002b | All other bytearray methods (such as :meth:`~bytearray.find`, :meth:`~bytearray.replace`, :meth:`~bytearray.split`, :meth:`~bytearray.decode`, etc.) hold the per-object lock for their duration.
Operations that involve multiple accesses, as well as iteration, are never
atomic: | trusted_official_docs | CPython Docs | All other bytearray methods (such as :meth:`~bytearray.find`, :meth:`~bytearray.replace`, :meth:`~bytearray.split`, :meth:`~bytearray.decode`, etc.) hold the per-object lock for their duration.
Operations that involve multiple accesses, as well as iteration, are never
atomic: | All other bytearray methods (such as :meth:`~bytearray.find`, :meth:`~bytearray.replace`, :meth:`~bytearray.split`, :meth:`~bytearray.decode`, etc.) hold the per-object lock for their duration.
Operations that involve multiple accesses, as well as iteration, are never
atomic: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7a6dfff0-0a1d-4808-8b8e-ab21bc970964 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,458 | supabase-export-v2 | 5410e33c3d2cb73b | :meth:`set.update`, :meth:`set.union`, :meth:`set.intersection` and :meth:`set.difference` can take multiple iterables as arguments. They all iterate through all the passed iterables and do the following:
* :meth:`set.update` and :meth:`set.union` lock both objects only when
the other operand is a :class:`set`, :class... | trusted_official_docs | CPython Docs | :meth:`set.update`, :meth:`set.union`, :meth:`set.intersection` and :meth:`set.difference` can take multiple iterables as arguments. They all iterate through all the passed iterables and do the following:
* :meth:`set.update` and :meth:`set.union` lock both objects only when
the other operand is a :class:`set`, :class... | :meth:`set.update`, :meth:`set.union`, :meth:`set.intersection` and :meth:`set.difference` can take multiple iterables as arguments. They all iterate through all the passed iterables and do the following:
* :meth:`set.update` and :meth:`set.union` lock both objects only when
the other operand is a :class:`set`, :class... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7c3c88a0-a44a-4514-a693-dd8496852216 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,381 | supabase-export-v2 | 2e2a70765fa92265 | All other operations from here on block using the :term:`per-object lock`.
Writing a single item via ``lst[i] = x`` is safe to call from multiple
threads and will not corrupt the list. | trusted_official_docs | CPython Docs | All other operations from here on block using the :term:`per-object lock`.
Writing a single item via ``lst[i] = x`` is safe to call from multiple
threads and will not corrupt the list. | All other operations from here on block using the :term:`per-object lock`.
Writing a single item via ``lst[i] = x`` is safe to call from multiple
threads and will not corrupt the list. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7f2d59a0-5059-4a2c-9c42-f4cf80acd907 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,504 | supabase-export-v2 | fca751f49e3e7bf3 | provide access to the internal data of an underlying object without copying. Thread safety depends on both the memoryview itself and the underlying buffer exporter.
The memoryview implementation uses atomic operations to track its own
exports in the :term:`free-threaded build`. Creating and
releasing a memoryview are t... | trusted_official_docs | CPython Docs | provide access to the internal data of an underlying object without copying. Thread safety depends on both the memoryview itself and the underlying buffer exporter.
The memoryview implementation uses atomic operations to track its own
exports in the :term:`free-threaded build`. Creating and
releasing a memoryview are t... | provide access to the internal data of an underlying object without copying. Thread safety depends on both the memoryview itself and the underlying buffer exporter.
The memoryview implementation uses atomic operations to track its own
exports in the :term:`free-threaded build`. Creating and
releasing a memoryview are t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
82bbadc7-4d75-46b8-9843-bd6a981a7203 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,505 | supabase-export-v2 | e9c740b3ca153b01 | reads fields that are immutable for the lifetime of the memoryview, so concurrent reads are safe as long as the memoryview has not been released.
However, the actual data accessed through the memoryview is owned by the
underlying object. Concurrent access to this data is only safe if the
underlying object supports it: | trusted_official_docs | CPython Docs | reads fields that are immutable for the lifetime of the memoryview, so concurrent reads are safe as long as the memoryview has not been released.
However, the actual data accessed through the memoryview is owned by the
underlying object. Concurrent access to this data is only safe if the
underlying object supports it: | reads fields that are immutable for the lifetime of the memoryview, so concurrent reads are safe as long as the memoryview has not been released.
However, the actual data accessed through the memoryview is owned by the
underlying object. Concurrent access to this data is only safe if the
underlying object supports it: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9c04b951-f59d-4a63-8b30-cec5a90a55b7 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,354 | supabase-export-v2 | 5d6b175edd095231 | Incompatible ------------
A function or operation that cannot be made safe for concurrent use even
with external synchronization. Incompatible code typically accesses
global state in an unsynchronized way and must only be called from a single
thread throughout the program's lifetime. | trusted_official_docs | CPython Docs | Incompatible ------------
A function or operation that cannot be made safe for concurrent use even
with external synchronization. Incompatible code typically accesses
global state in an unsynchronized way and must only be called from a single
thread throughout the program's lifetime. | Incompatible ------------
A function or operation that cannot be made safe for concurrent use even
with external synchronization. Incompatible code typically accesses
global state in an unsynchronized way and must only be called from a single
thread throughout the program's lifetime. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a5551547-479d-4216-b395-7cd7d2ed38bd | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,507 | supabase-export-v2 | 42d22f4a15649b13 | * For immutable objects like :class:`bytes`, concurrent reads through multiple memoryviews are safe.
* For mutable objects like :class:`bytearray`, reading and writing the
same memory region from multiple threads without external
synchronization is not safe and may result in data corruption. Note that even read-only ... | trusted_official_docs | CPython Docs | * For immutable objects like :class:`bytes`, concurrent reads through multiple memoryviews are safe.
* For mutable objects like :class:`bytearray`, reading and writing the
same memory region from multiple threads without external
synchronization is not safe and may result in data corruption. Note that even read-only ... | * For immutable objects like :class:`bytes`, concurrent reads through multiple memoryviews are safe.
* For mutable objects like :class:`bytearray`, reading and writing the
same memory region from multiple threads without external
synchronization is not safe and may result in data corruption. Note that even read-only ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
adf717ae-a7d7-41d7-a3f3-f3949e60ed19 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,412 | supabase-export-v2 | 07e26be07591e462 | value # write del d[key] # delete d.pop(key) # remove and return d.popitem() # remove and return last item d.setdefault(key, v) # insert if missing
These operations may compare keys using :meth:`~object.__eq__`, which can
execute arbitrary Python code. During such comparisons, the dictionary may
be modified by another ... | trusted_official_docs | CPython Docs | value # write del d[key] # delete d.pop(key) # remove and return d.popitem() # remove and return last item d.setdefault(key, v) # insert if missing
These operations may compare keys using :meth:`~object.__eq__`, which can
execute arbitrary Python code. During such comparisons, the dictionary may
be modified by another ... | value # write del d[key] # delete d.pop(key) # remove and return d.popitem() # remove and return last item d.setdefault(key, v) # insert if missing
These operations may compare keys using :meth:`~object.__eq__`, which can
execute arbitrary Python code. During such comparisons, the dictionary may
be modified by another ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ae3aab1a-caa6-4539-93f4-4958523da719 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,443 | supabase-export-v2 | 9ff6997ac9d56bf0 | The :func:`len` function is lock-free and :term:`atomic <atomic operation>`.
The following read operation is lock-free. It does not block concurrent
modifications and may observe intermediate states from operations that
hold the per-object lock: | trusted_official_docs | CPython Docs | The :func:`len` function is lock-free and :term:`atomic <atomic operation>`.
The following read operation is lock-free. It does not block concurrent
modifications and may observe intermediate states from operations that
hold the per-object lock: | The :func:`len` function is lock-free and :term:`atomic <atomic operation>`.
The following read operation is lock-free. It does not block concurrent
modifications and may observe intermediate states from operations that
hold the per-object lock: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b5651fab-e192-48b3-8691-47ed6a5403ef | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,395 | supabase-export-v2 | 644a31c608651746 | which can be concurrently modified by another thread. The same applies to inplace concatenation of a list with other iterables when using ``lst += iterable``.
Similarly, assigning to a list slice with ``lst[i:j] = iterable`` is safe
to call from multiple threads, but ``iterable`` is only locked when it is
also a :class... | trusted_official_docs | CPython Docs | which can be concurrently modified by another thread. The same applies to inplace concatenation of a list with other iterables when using ``lst += iterable``.
Similarly, assigning to a list slice with ``lst[i:j] = iterable`` is safe
to call from multiple threads, but ``iterable`` is only locked when it is
also a :class... | which can be concurrently modified by another thread. The same applies to inplace concatenation of a list with other iterables when using ``lst += iterable``.
Similarly, assigning to a list slice with ``lst[i:j] = iterable`` is safe
to call from multiple threads, but ``iterable`` is only locked when it is
also a :class... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b8334d29-8f62-4da3-b706-396202d64863 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,396 | supabase-export-v2 | 3fdb2bf9f9570ec3 | ``lst[i:j] = iterable`` is safe to call from multiple threads, but ``iterable`` is only locked when it is also a :class:`list` (but not its subclasses).
Operations that involve multiple accesses, as well as iteration, are never
atomic. For example: | trusted_official_docs | CPython Docs | ``lst[i:j] = iterable`` is safe to call from multiple threads, but ``iterable`` is only locked when it is also a :class:`list` (but not its subclasses).
Operations that involve multiple accesses, as well as iteration, are never
atomic. For example: | ``lst[i:j] = iterable`` is safe to call from multiple threads, but ``iterable`` is only locked when it is also a :class:`list` (but not its subclasses).
Operations that involve multiple accesses, as well as iteration, are never
atomic. For example: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bb7322a5-4896-4f3c-ab1c-89bc77360704 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,506 | supabase-export-v2 | b7da3cc5fe873cc5 | data accessed through the memoryview is owned by the underlying object. Concurrent access to this data is only safe if the underlying object supports it:
* For immutable objects like :class:`bytes`, concurrent reads through
multiple memoryviews are safe. | trusted_official_docs | CPython Docs | data accessed through the memoryview is owned by the underlying object. Concurrent access to this data is only safe if the underlying object supports it:
* For immutable objects like :class:`bytes`, concurrent reads through
multiple memoryviews are safe. | data accessed through the memoryview is owned by the underlying object. Concurrent access to this data is only safe if the underlying object supports it:
* For immutable objects like :class:`bytes`, concurrent reads through
multiple memoryviews are safe. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bce0f962-f379-4477-a30a-4872484d3999 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,417 | supabase-export-v2 | 56e62ac0f76c8ddd | The :meth:`~dict.clear` method holds the lock for its duration. Other threads cannot observe elements being removed.
The following operations lock both dictionaries. For :meth:`~dict.update`
and ``|=``, this applies only when the other operand is a :class:`dict`
that uses the standard dict iterator (but not subclasses ... | trusted_official_docs | CPython Docs | The :meth:`~dict.clear` method holds the lock for its duration. Other threads cannot observe elements being removed.
The following operations lock both dictionaries. For :meth:`~dict.update`
and ``|=``, this applies only when the other operand is a :class:`dict`
that uses the standard dict iterator (but not subclasses ... | The :meth:`~dict.clear` method holds the lock for its duration. Other threads cannot observe elements being removed.
The following operations lock both dictionaries. For :meth:`~dict.update`
and ``|=``, this applies only when the other operand is a :class:`dict`
that uses the standard dict iterator (but not subclasses ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c0e690a9-902c-4cc7-935f-89c099a65b06 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,415 | supabase-export-v2 | f4d7cb626b7245dc | .. code-block:: :class: good
d.copy() # returns a shallow copy of the dictionary
d | other # merges two dicts into a new dict
d.keys() # returns a new dict_keys view object
d.values() # returns a new dict_values view object
d.items() # returns a new dict_items view object | trusted_official_docs | CPython Docs | .. code-block:: :class: good
d.copy() # returns a shallow copy of the dictionary
d | other # merges two dicts into a new dict
d.keys() # returns a new dict_keys view object
d.values() # returns a new dict_values view object
d.items() # returns a new dict_items view object | .. code-block:: :class: good
d.copy() # returns a shallow copy of the dictionary
d | other # merges two dicts into a new dict
d.keys() # returns a new dict_keys view object
d.values() # returns a new dict_values view object
d.items() # returns a new dict_items view object | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c18db84f-b0a7-40a4-acff-4e67e10bc672 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,473 | supabase-export-v2 | afaa630ae8a7bd87 | The :func:`len` function is lock-free and :term:`atomic <atomic operation>`.
Concatenation and comparisons use the buffer protocol, which prevents
resizing but does not hold the per-object lock. These operations may
observe intermediate states from concurrent modifications: | trusted_official_docs | CPython Docs | The :func:`len` function is lock-free and :term:`atomic <atomic operation>`.
Concatenation and comparisons use the buffer protocol, which prevents
resizing but does not hold the per-object lock. These operations may
observe intermediate states from concurrent modifications: | The :func:`len` function is lock-free and :term:`atomic <atomic operation>`.
Concatenation and comparisons use the buffer protocol, which prevents
resizing but does not hold the per-object lock. These operations may
observe intermediate states from concurrent modifications: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c241ec4f-aa56-4815-ba80-8f023418e423 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,379 | supabase-export-v2 | eba84362afbdd7a7 | item in lst lst.index(item) lst.count(item)
All of the above operations avoid acquiring :term:`per-object locks
<per-object lock>`. They do not block concurrent modifications. Other
operations that hold a lock will not block these from observing intermediate
states. | trusted_official_docs | CPython Docs | item in lst lst.index(item) lst.count(item)
All of the above operations avoid acquiring :term:`per-object locks
<per-object lock>`. They do not block concurrent modifications. Other
operations that hold a lock will not block these from observing intermediate
states. | item in lst lst.index(item) lst.count(item)
All of the above operations avoid acquiring :term:`per-object locks
<per-object lock>`. They do not block concurrent modifications. Other
operations that hold a lock will not block these from observing intermediate
states. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c598bc41-6342-4ad0-b52a-a351663c6f39 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,369 | supabase-export-v2 | 126eb8939cd4c672 | Atomic ------
A function or operation that appears :term:`atomic <atomic operation>` with
respect to other threads - it executes instantaneously from the perspective
of other threads. This is the strongest form of thread safety. | trusted_official_docs | CPython Docs | Atomic ------
A function or operation that appears :term:`atomic <atomic operation>` with
respect to other threads - it executes instantaneously from the perspective
of other threads. This is the strongest form of thread safety. | Atomic ------
A function or operation that appears :term:`atomic <atomic operation>` with
respect to other threads - it executes instantaneously from the perspective
of other threads. This is the strongest form of thread safety. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cb00fcab-a381-4c8e-8b58-a316137d2c2c | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,404 | supabase-export-v2 | f7bd74d0c90a838f | Thread safety for dict objects ==============================
Creating a dictionary with the :class:`dict` constructor is atomic when the
argument to it is a :class:`dict` or a :class:`tuple`. When using the
:meth:`dict.fromkeys` method, dictionary creation is atomic when the
argument is a :class:`dict`, :class:`tuple`... | trusted_official_docs | CPython Docs | Thread safety for dict objects ==============================
Creating a dictionary with the :class:`dict` constructor is atomic when the
argument to it is a :class:`dict` or a :class:`tuple`. When using the
:meth:`dict.fromkeys` method, dictionary creation is atomic when the
argument is a :class:`dict`, :class:`tuple`... | Thread safety for dict objects ==============================
Creating a dictionary with the :class:`dict` constructor is atomic when the
argument to it is a :class:`dict` or a :class:`tuple`. When using the
:meth:`dict.fromkeys` method, dictionary creation is atomic when the
argument is a :class:`dict`, :class:`tuple`... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cf409be6-0b62-4b44-9b5d-6f1253eb1b6e | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,447 | supabase-export-v2 | ef2b0846de2e7207 | another thread. For built-in types like :class:`str`, :class:`int`, and :class:`float`, :meth:`!__eq__` does not release the underlying lock during comparisons and this is not a concern.
All other operations from here on hold the per-object lock. | trusted_official_docs | CPython Docs | another thread. For built-in types like :class:`str`, :class:`int`, and :class:`float`, :meth:`!__eq__` does not release the underlying lock during comparisons and this is not a concern.
All other operations from here on hold the per-object lock. | another thread. For built-in types like :class:`str`, :class:`int`, and :class:`float`, :meth:`!__eq__` does not release the underlying lock during comparisons and this is not a concern.
All other operations from here on hold the per-object lock. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d465d040-00d7-4108-94a4-a63af9a89b00 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,509 | supabase-export-v2 | 7982b0d33ac622b0 | .. code-block:: :class: bad
# NOT safe: concurrent writes to the same buffer
data = bytearray(1000)
view = memoryview(data)
# Thread 1: view[0:500] = b'x' * 500
# Thread 2: view[0:500] = b'y' * 500 | trusted_official_docs | CPython Docs | .. code-block:: :class: bad
# NOT safe: concurrent writes to the same buffer
data = bytearray(1000)
view = memoryview(data)
# Thread 1: view[0:500] = b'x' * 500
# Thread 2: view[0:500] = b'y' * 500 | .. code-block:: :class: bad
# NOT safe: concurrent writes to the same buffer
data = bytearray(1000)
view = memoryview(data)
# Thread 1: view[0:500] = b'x' * 500
# Thread 2: view[0:500] = b'y' * 500 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d5301a98-4126-417f-a09f-c9f3a61f7dfb | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,482 | supabase-export-v2 | 458cd160f2d84aba | .. code-block:: :class: good
ba[i] = x # write single byte
ba[i:j] = values # write slice
ba.append(x) # append single byte
ba.extend(other) # extend with iterable
ba.insert(i, x) # insert single byte
ba.pop() # remove and return last byte
ba.pop(i) # remove and return byte at index
ba.remove(x) # remove first o... | trusted_official_docs | CPython Docs | .. code-block:: :class: good
ba[i] = x # write single byte
ba[i:j] = values # write slice
ba.append(x) # append single byte
ba.extend(other) # extend with iterable
ba.insert(i, x) # insert single byte
ba.pop() # remove and return last byte
ba.pop(i) # remove and return byte at index
ba.remove(x) # remove first o... | .. code-block:: :class: good
ba[i] = x # write single byte
ba[i:j] = values # write slice
ba.append(x) # append single byte
ba.extend(other) # extend with iterable
ba.insert(i, x) # insert single byte
ba.pop() # remove and return last byte
ba.pop(i) # remove and return byte at index
ba.remove(x) # remove first o... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dc1131bb-f6f2-4ea4-b2fa-49c32f1e8458 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,380 | supabase-export-v2 | d7b2573962d76fab | acquiring :term:`per-object locks <per-object lock>`. They do not block concurrent modifications. Other operations that hold a lock will not block these from observing intermediate states.
All other operations from here on block using the :term:`per-object lock`. | trusted_official_docs | CPython Docs | acquiring :term:`per-object locks <per-object lock>`. They do not block concurrent modifications. Other operations that hold a lock will not block these from observing intermediate states.
All other operations from here on block using the :term:`per-object lock`. | acquiring :term:`per-object locks <per-object lock>`. They do not block concurrent modifications. Other operations that hold a lock will not block these from observing intermediate states.
All other operations from here on block using the :term:`per-object lock`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dd5099d9-7f69-483a-8fc8-25611dbf2439 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,459 | supabase-export-v2 | 90535d63c0718d54 | :meth:`set.union` lock both objects only when the other operand is a :class:`set`, :class:`frozenset`, or :class:`dict`. * :meth:`set.intersection` and :meth:`set.difference` always try to lock all objects.
:meth:`set.symmetric_difference` tries to lock both objects. | trusted_official_docs | CPython Docs | :meth:`set.union` lock both objects only when the other operand is a :class:`set`, :class:`frozenset`, or :class:`dict`. * :meth:`set.intersection` and :meth:`set.difference` always try to lock all objects.
:meth:`set.symmetric_difference` tries to lock both objects. | :meth:`set.union` lock both objects only when the other operand is a :class:`set`, :class:`frozenset`, or :class:`dict`. * :meth:`set.intersection` and :meth:`set.difference` always try to lock all objects.
:meth:`set.symmetric_difference` tries to lock both objects. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e1cf36fb-7258-4b4e-a3a9-f38b2155e9fd | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,427 | supabase-export-v2 | eb8bb548b4132c35 | only d locked d |= iterable # iterable is not a dict: only d locked dict.fromkeys(iterable) # iterable is not a dict/set/frozenset: only result locked
Operations that involve multiple accesses, as well as iteration, are never
atomic: | trusted_official_docs | CPython Docs | only d locked d |= iterable # iterable is not a dict: only d locked dict.fromkeys(iterable) # iterable is not a dict/set/frozenset: only result locked
Operations that involve multiple accesses, as well as iteration, are never
atomic: | only d locked d |= iterable # iterable is not a dict: only d locked dict.fromkeys(iterable) # iterable is not a dict/set/frozenset: only result locked
Operations that involve multiple accesses, as well as iteration, are never
atomic: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e526d4f0-3ad3-4f4a-b3b9-d6fd1f9e682b | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,413 | supabase-export-v2 | bd2f4869f394e008 | types like :class:`str`, :class:`int`, and :class:`float`, that implement :meth:`~object.__eq__` in C, the underlying lock is not released during comparisons and this is not a concern.
The following operations return new objects and hold the :term:`per-object lock`
for the duration of the operation: | trusted_official_docs | CPython Docs | types like :class:`str`, :class:`int`, and :class:`float`, that implement :meth:`~object.__eq__` in C, the underlying lock is not released during comparisons and this is not a concern.
The following operations return new objects and hold the :term:`per-object lock`
for the duration of the operation: | types like :class:`str`, :class:`int`, and :class:`float`, that implement :meth:`~object.__eq__` in C, the underlying lock is not released during comparisons and this is not a concern.
The following operations return new objects and hold the :term:`per-object lock`
for the duration of the operation: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e88b8fd6-c91c-49a7-9626-fb45e59114ee | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,483 | supabase-export-v2 | 03643beb9292f524 | last byte ba.pop(i) # remove and return byte at index ba.remove(x) # remove first occurrence ba.reverse() # reverse in place ba.clear() # remove all bytes
Slice assignment locks both objects when *values* is a :class:`bytearray`: | trusted_official_docs | CPython Docs | last byte ba.pop(i) # remove and return byte at index ba.remove(x) # remove first occurrence ba.reverse() # reverse in place ba.clear() # remove all bytes
Slice assignment locks both objects when *values* is a :class:`bytearray`: | last byte ba.pop(i) # remove and return byte at index ba.remove(x) # remove first occurrence ba.reverse() # reverse in place ba.clear() # remove all bytes
Slice assignment locks both objects when *values* is a :class:`bytearray`: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
edb8f8fb-fd12-4f76-a2b1-6673feda9941 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,367 | supabase-export-v2 | 4fe7c65ba2507f59 | (such as :term:`per-object locks <per-object lock>` or :ref:`critical sections <python-critical-section-api>`) to protect shared mutable state, so callers do not need to supply their own locking.
Example: :c:func:`PyList_GetItemRef` can be called from multiple threads on the
same :c:type:`PyListObject` - it uses intern... | trusted_official_docs | CPython Docs | (such as :term:`per-object locks <per-object lock>` or :ref:`critical sections <python-critical-section-api>`) to protect shared mutable state, so callers do not need to supply their own locking.
Example: :c:func:`PyList_GetItemRef` can be called from multiple threads on the
same :c:type:`PyListObject` - it uses intern... | (such as :term:`per-object locks <per-object lock>` or :ref:`critical sections <python-critical-section-api>`) to protect shared mutable state, so callers do not need to supply their own locking.
Example: :c:func:`PyList_GetItemRef` can be called from multiple threads on the
same :c:type:`PyListObject` - it uses intern... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f596eef1-43bc-4d1a-a520-939863c86a5d | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,420 | supabase-export-v2 | 6121e44199f2a63c | other_dict is a dict d |= other_dict # both locked when other_dict is a dict d == other_dict # both locked for dict and subclasses
All comparison operations also compare values using :meth:`~object.__eq__`,
so for non-built-in types the lock may be released during comparison. | trusted_official_docs | CPython Docs | other_dict is a dict d |= other_dict # both locked when other_dict is a dict d == other_dict # both locked for dict and subclasses
All comparison operations also compare values using :meth:`~object.__eq__`,
so for non-built-in types the lock may be released during comparison. | other_dict is a dict d |= other_dict # both locked when other_dict is a dict d == other_dict # both locked for dict and subclasses
All comparison operations also compare values using :meth:`~object.__eq__`,
so for non-built-in types the lock may be released during comparison. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f9608d71-7261-4bae-8c97-4bf155215ae7 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,358 | supabase-export-v2 | 29ddaf8cce6b322d | Compatible ----------
A function or operation that is safe to call from multiple threads
*provided* the caller supplies appropriate external synchronization, for
example by holding a :term:`lock` for the duration of each call. Without
such synchronization, concurrent calls may produce :term:`race conditions
<race condi... | trusted_official_docs | CPython Docs | Compatible ----------
A function or operation that is safe to call from multiple threads
*provided* the caller supplies appropriate external synchronization, for
example by holding a :term:`lock` for the duration of each call. Without
such synchronization, concurrent calls may produce :term:`race conditions
<race condi... | Compatible ----------
A function or operation that is safe to call from multiple threads
*provided* the caller supplies appropriate external synchronization, for
example by holding a :term:`lock` for the duration of each call. Without
such synchronization, concurrent calls may produce :term:`race conditions
<race condi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f9a39ef4-ddbb-4439-b307-8f416d6e8a4c | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,370 | supabase-export-v2 | 106e494b0290bda4 | <atomic operation>` with respect to other threads - it executes instantaneously from the perspective of other threads. This is the strongest form of thread safety.
Example: :c:func:`PyMutex_IsLocked` performs an atomic read of the mutex
state and can be called from any thread at any time. | trusted_official_docs | CPython Docs | <atomic operation>` with respect to other threads - it executes instantaneously from the perspective of other threads. This is the strongest form of thread safety.
Example: :c:func:`PyMutex_IsLocked` performs an atomic read of the mutex
state and can be called from any thread at any time. | <atomic operation>` with respect to other threads - it executes instantaneously from the perspective of other threads. This is the strongest form of thread safety.
Example: :c:func:`PyMutex_IsLocked` performs an atomic read of the mutex
state and can be called from any thread at any time. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fa96a22a-9b56-45f3-b537-ca09b6242867 | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,497 | supabase-export-v2 | 1869ec393b12db05 | # NOT thread-safe: iteration while modifying for byte in ba: process(byte) # another thread may modify ba
To safely iterate over a bytearray that may be modified by another
thread, iterate over a copy: | trusted_official_docs | CPython Docs | # NOT thread-safe: iteration while modifying for byte in ba: process(byte) # another thread may modify ba
To safely iterate over a bytearray that may be modified by another
thread, iterate over a copy: | # NOT thread-safe: iteration while modifying for byte in ba: process(byte) # another thread may modify ba
To safely iterate over a bytearray that may be modified by another
thread, iterate over a copy: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fc22fc91-535b-4283-9053-d8d4baa93e2a | CPython Docs | file://datasets/cpython/Doc/library/threadsafety.rst | unknown | 7b7dba10-d777-4a50-bdf0-f9e05fe3019b | 40,476 | supabase-export-v2 | 75211643da11bd13 | ba + other # may observe concurrent writes ba == other # may observe concurrent writes ba < other # may observe concurrent writes
All other operations from here on hold the per-object lock. | trusted_official_docs | CPython Docs | ba + other # may observe concurrent writes ba == other # may observe concurrent writes ba < other # may observe concurrent writes
All other operations from here on hold the per-object lock. | ba + other # may observe concurrent writes ba == other # may observe concurrent writes ba < other # may observe concurrent writes
All other operations from here on hold the per-object lock. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
018465fd-f59c-45c4-b290-30792103f0cc | CPython Docs | file://datasets/cpython/Doc/library/asyncio.rst | unknown | e6bf256d-8999-42f7-b10f-b4d807936f39 | 40,522 | supabase-export-v2 | 3ec3cd5d960bf827 | asyncio is used as a foundation for multiple Python asynchronous frameworks that provide high-performance network and web-servers, database connection libraries, distributed task queues, etc.
asyncio is often a perfect fit for IO-bound and high-level
**structured** network code. | trusted_official_docs | CPython Docs | asyncio is used as a foundation for multiple Python asynchronous frameworks that provide high-performance network and web-servers, database connection libraries, distributed task queues, etc.
asyncio is often a perfect fit for IO-bound and high-level
**structured** network code. | asyncio is used as a foundation for multiple Python asynchronous frameworks that provide high-performance network and web-servers, database connection libraries, distributed task queues, etc.
asyncio is often a perfect fit for IO-bound and high-level
**structured** network code. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9639ce4b-7688-4561-8fa5-f68437dd7d7a | CPython Docs | file://datasets/cpython/Doc/library/asyncio.rst | unknown | e6bf256d-8999-42f7-b10f-b4d807936f39 | 40,521 | supabase-export-v2 | fac7637308de1747 | asyncio is a library to write **concurrent** code using the **async/await** syntax.
asyncio is used as a foundation for multiple Python asynchronous
frameworks that provide high-performance network and web-servers,
database connection libraries, distributed task queues, etc. | trusted_official_docs | CPython Docs | asyncio is a library to write **concurrent** code using the **async/await** syntax.
asyncio is used as a foundation for multiple Python asynchronous
frameworks that provide high-performance network and web-servers,
database connection libraries, distributed task queues, etc. | asyncio is a library to write **concurrent** code using the **async/await** syntax.
asyncio is used as a foundation for multiple Python asynchronous
frameworks that provide high-performance network and web-servers,
database connection libraries, distributed task queues, etc. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9769bf70-4147-417f-aa4b-13ba95b4f7f5 | CPython Docs | file://datasets/cpython/Doc/library/asyncio.rst | unknown | e6bf256d-8999-42f7-b10f-b4d807936f39 | 40,544 | supabase-export-v2 | e71f559129b663e8 | .. versionchanged:: 3.13 Uses PyREPL if possible, in which case :envvar:`PYTHONSTARTUP` is also executed. Emits audit events.
.. We use the "rubric" directive here to avoid creating
the "Reference" subsection in the TOC. | trusted_official_docs | CPython Docs | .. versionchanged:: 3.13 Uses PyREPL if possible, in which case :envvar:`PYTHONSTARTUP` is also executed. Emits audit events.
.. We use the "rubric" directive here to avoid creating
the "Reference" subsection in the TOC. | .. versionchanged:: 3.13 Uses PyREPL if possible, in which case :envvar:`PYTHONSTARTUP` is also executed. Emits audit events.
.. We use the "rubric" directive here to avoid creating
the "Reference" subsection in the TOC. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
af8a168d-4755-4940-8f0f-bea7f01b643a | CPython Docs | file://datasets/cpython/Doc/library/asyncio.rst | unknown | e6bf256d-8999-42f7-b10f-b4d807936f39 | 40,539 | supabase-export-v2 | 3c3951030695252b | .. code-block:: pycon
$ python -m asyncio
asyncio REPL ... Use "await" directly instead of "asyncio.run()". Type "help", "copyright", "credits" or "license" for more information. >>> import asyncio
>>> await asyncio.sleep(10, result='hello')
'hello' | trusted_official_docs | CPython Docs | .. code-block:: pycon
$ python -m asyncio
asyncio REPL ... Use "await" directly instead of "asyncio.run()". Type "help", "copyright", "credits" or "license" for more information. >>> import asyncio
>>> await asyncio.sleep(10, result='hello')
'hello' | .. code-block:: pycon
$ python -m asyncio
asyncio REPL ... Use "await" directly instead of "asyncio.run()". Type "help", "copyright", "credits" or "license" for more information. >>> import asyncio
>>> await asyncio.sleep(10, result='hello')
'hello' | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
de58aeba-ef9f-4f41-be7b-2a1b0fb2409b | CPython Docs | file://datasets/cpython/Doc/library/asyncio.rst | unknown | e6bf256d-8999-42f7-b10f-b4d807936f39 | 40,532 | supabase-export-v2 | ef155b2236a516d4 | Additionally, there are **low-level** APIs for *library and framework developers* to:
* create and manage :ref:`event loops <asyncio-event-loop>`, which
provide asynchronous APIs for :ref:`networking <loop_create_server>`,
running :ref:`subprocesses <loop_subprocess_exec>`,
handling :ref:`OS signals <loop_add_signal... | trusted_official_docs | CPython Docs | Additionally, there are **low-level** APIs for *library and framework developers* to:
* create and manage :ref:`event loops <asyncio-event-loop>`, which
provide asynchronous APIs for :ref:`networking <loop_create_server>`,
running :ref:`subprocesses <loop_subprocess_exec>`,
handling :ref:`OS signals <loop_add_signal... | Additionally, there are **low-level** APIs for *library and framework developers* to:
* create and manage :ref:`event loops <asyncio-event-loop>`, which
provide asynchronous APIs for :ref:`networking <loop_create_server>`,
running :ref:`subprocesses <loop_subprocess_exec>`,
handling :ref:`OS signals <loop_add_signal... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
df7e89a6-c815-4374-a37c-b08a40452737 | CPython Docs | file://datasets/cpython/Doc/library/asyncio.rst | unknown | e6bf256d-8999-42f7-b10f-b4d807936f39 | 40,540 | supabase-export-v2 | c75eb3d810124999 | REPL ... Use "await" directly instead of "asyncio.run()". Type "help", "copyright", "credits" or "license" for more information. >>> import asyncio >>> await asyncio.sleep(10, result='hello') 'hello'
This REPL provides limited compatibility with :envvar:`PYTHON_BASIC_REPL`. It is recommended that the default REPL is us... | trusted_official_docs | CPython Docs | REPL ... Use "await" directly instead of "asyncio.run()". Type "help", "copyright", "credits" or "license" for more information. >>> import asyncio >>> await asyncio.sleep(10, result='hello') 'hello'
This REPL provides limited compatibility with :envvar:`PYTHON_BASIC_REPL`. It is recommended that the default REPL is us... | REPL ... Use "await" directly instead of "asyncio.run()". Type "help", "copyright", "credits" or "license" for more information. >>> import asyncio >>> await asyncio.sleep(10, result='hello') 'hello'
This REPL provides limited compatibility with :envvar:`PYTHON_BASIC_REPL`. It is recommended that the default REPL is us... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
00303189-0dbe-4e08-86e7-fe3ea59ced70 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,740 | supabase-export-v2 | f95390627f3828a0 | meaningful results, the number of data points in *data* should be larger than *n*. Raises :exc:`StatisticsError` if there is not at least one data point.
The cut points are linearly interpolated from the
two nearest data points. For example, if a cut point falls one-third
of the distance between two sample values, ``... | trusted_official_docs | CPython Docs | meaningful results, the number of data points in *data* should be larger than *n*. Raises :exc:`StatisticsError` if there is not at least one data point.
The cut points are linearly interpolated from the
two nearest data points. For example, if a cut point falls one-third
of the distance between two sample values, ``... | meaningful results, the number of data points in *data* should be larger than *n*. Raises :exc:`StatisticsError` if there is not at least one data point.
The cut points are linearly interpolated from the
two nearest data points. For example, if a cut point falls one-third
of the distance between two sample values, ``... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
03ed84ec-e3c4-415b-96a3-aeedd1d6d6c8 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,680 | supabase-export-v2 | 2f73e3963b08e268 | the *data*. If the smallest or largest of those is desired instead, use ``min(multimode(data))`` or ``max(multimode(data))``. If the input *data* is empty, :exc:`StatisticsError` is raised.
``mode`` assumes discrete data and returns a single value. This is the
standard treatment of the mode as commonly taught in schoo... | trusted_official_docs | CPython Docs | the *data*. If the smallest or largest of those is desired instead, use ``min(multimode(data))`` or ``max(multimode(data))``. If the input *data* is empty, :exc:`StatisticsError` is raised.
``mode`` assumes discrete data and returns a single value. This is the
standard treatment of the mode as commonly taught in schoo... | the *data*. If the smallest or largest of those is desired instead, use ``min(multimode(data))`` or ``max(multimode(data))``. If the input *data* is empty, :exc:`StatisticsError` is raised.
``mode`` assumes discrete data and returns a single value. This is the
standard treatment of the mode as commonly taught in schoo... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0410a113-9d4a-4402-94fd-7da18214c74e | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,646 | supabase-export-v2 | eba0f6db89bac132 | of numeric data, using the common "mean of middle two" method. If *data* is empty, :exc:`StatisticsError` is raised. *data* can be a sequence or iterable.
The median is a robust measure of central location and is less affected by
the presence of outliers. When the number of data points is odd, the
middle data point i... | trusted_official_docs | CPython Docs | of numeric data, using the common "mean of middle two" method. If *data* is empty, :exc:`StatisticsError` is raised. *data* can be a sequence or iterable.
The median is a robust measure of central location and is less affected by
the presence of outliers. When the number of data points is odd, the
middle data point i... | of numeric data, using the common "mean of middle two" method. If *data* is empty, :exc:`StatisticsError` is raised. *data* can be a sequence or iterable.
The median is a robust measure of central location and is less affected by
the presence of outliers. When the number of data points is odd, the
middle data point i... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
078052c0-314e-4cad-86de-98fc466cabc8 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,757 | supabase-export-v2 | a041ca721be284cc | is replaced by ranks. Ties are averaged so that equal values receive the same rank. The resulting coefficient measures the strength of a monotonic relationship.
Spearman's correlation coefficient is appropriate for ordinal data or for
continuous data that doesn't meet the linear proportion requirement for
Pearson's c... | trusted_official_docs | CPython Docs | is replaced by ranks. Ties are averaged so that equal values receive the same rank. The resulting coefficient measures the strength of a monotonic relationship.
Spearman's correlation coefficient is appropriate for ordinal data or for
continuous data that doesn't meet the linear proportion requirement for
Pearson's c... | is replaced by ranks. Ties are averaged so that equal values receive the same rank. The resulting coefficient measures the strength of a monotonic relationship.
Spearman's correlation coefficient is appropriate for ordinal data or for
continuous data that doesn't meet the linear proportion requirement for
Pearson's c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
07e870fe-abd9-409e-b459-b25c51703649 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,738 | supabase-export-v2 | 9372d96dc5c8a185 | Divide *data* into *n* continuous intervals with equal probability. Returns a list of ``n - 1`` cut points separating the intervals.
Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles. Set
*n* to 100 for percentiles which gives the 99 cuts points that separate
*data* into 100 equal sized groups. Rais... | trusted_official_docs | CPython Docs | Divide *data* into *n* continuous intervals with equal probability. Returns a list of ``n - 1`` cut points separating the intervals.
Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles. Set
*n* to 100 for percentiles which gives the 99 cuts points that separate
*data* into 100 equal sized groups. Rais... | Divide *data* into *n* continuous intervals with equal probability. Returns a list of ``n - 1`` cut points separating the intervals.
Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles. Set
*n* to 100 for percentiles which gives the 99 cuts points that separate
*data* into 100 equal sized groups. Rais... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0a0325f2-69b5-4dc6-b3a0-03822fde371a | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,701 | supabase-export-v2 | 58196bdf48533594 | this function to calculate the variance from the entire population. To estimate the variance from a sample, the :func:`variance` function is usually a better choice.
Raises :exc:`StatisticsError` if *data* is empty. | trusted_official_docs | CPython Docs | this function to calculate the variance from the entire population. To estimate the variance from a sample, the :func:`variance` function is usually a better choice.
Raises :exc:`StatisticsError` if *data* is empty. | this function to calculate the variance from the entire population. To estimate the variance from a sample, the :func:`variance` function is usually a better choice.
Raises :exc:`StatisticsError` if *data* is empty. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0a0d7798-a458-485f-8731-ac6576fc01c6 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,645 | supabase-export-v2 | 6ea350923961640e | .. function:: median(data)
Return the median (middle value) of numeric data, using the common "mean of
middle two" method. If *data* is empty, :exc:`StatisticsError` is raised. *data* can be a sequence or iterable. | trusted_official_docs | CPython Docs | .. function:: median(data)
Return the median (middle value) of numeric data, using the common "mean of
middle two" method. If *data* is empty, :exc:`StatisticsError` is raised. *data* can be a sequence or iterable. | .. function:: median(data)
Return the median (middle value) of numeric data, using the common "mean of
middle two" method. If *data* is empty, :exc:`StatisticsError` is raised. *data* can be a sequence or iterable. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0bb39b8c-fb82-4f65-a970-ea6361e11504 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,605 | supabase-export-v2 | 3b81b241244da91f | the input dataset is empty, if it contains a zero, or if it contains a negative value. The *data* may be a sequence or iterable.
No special efforts are made to achieve exact results. (However, this may change in the future.) | trusted_official_docs | CPython Docs | the input dataset is empty, if it contains a zero, or if it contains a negative value. The *data* may be a sequence or iterable.
No special efforts are made to achieve exact results. (However, this may change in the future.) | the input dataset is empty, if it contains a zero, or if it contains a negative value. The *data* may be a sequence or iterable.
No special efforts are made to achieve exact results. (However, this may change in the future.) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0bee9303-1c93-4a1a-9a19-a90e2df93080 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,831 | supabase-export-v2 | 81d86a10e0197e01 | >>> temperature_february = NormalDist(5, 2.5) # Celsius >>> temperature_february * (9/5) + 32 # Fahrenheit NormalDist(mu=41.0, sigma=4.5)
Dividing a constant by an instance of :class:`NormalDist` is not supported
because the result wouldn't be normally distributed. | trusted_official_docs | CPython Docs | >>> temperature_february = NormalDist(5, 2.5) # Celsius >>> temperature_february * (9/5) + 32 # Fahrenheit NormalDist(mu=41.0, sigma=4.5)
Dividing a constant by an instance of :class:`NormalDist` is not supported
because the result wouldn't be normally distributed. | >>> temperature_february = NormalDist(5, 2.5) # Celsius >>> temperature_february * (9/5) + 32 # Fahrenheit NormalDist(mu=41.0, sigma=4.5)
Dividing a constant by an instance of :class:`NormalDist` is not supported
because the result wouldn't be normally distributed. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
119d8b80-a8c6-4bd0-948e-c7ba239d64f6 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,719 | supabase-export-v2 | e3f1398a5bfc4424 | .. function:: variance(data, xbar=None)
Return the sample variance of *data*, an iterable of at least two real-valued
numbers. Variance, or second moment about the mean, is a measure of the
variability (spread or dispersion) of data. A large variance indicates that
the data is spread out; a small variance indicates ... | trusted_official_docs | CPython Docs | .. function:: variance(data, xbar=None)
Return the sample variance of *data*, an iterable of at least two real-valued
numbers. Variance, or second moment about the mean, is a measure of the
variability (spread or dispersion) of data. A large variance indicates that
the data is spread out; a small variance indicates ... | .. function:: variance(data, xbar=None)
Return the sample variance of *data*, an iterable of at least two real-valued
numbers. Variance, or second moment about the mean, is a measure of the
variability (spread or dispersion) of data. A large variance indicates that
the data is spread out; a small variance indicates ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
14dc9951-4ff7-4fab-ace6-3e6b18840a6f | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,712 | supabase-export-v2 | d55af9ea4c62bdd6 | .. note::
When called with the entire population, this gives the population variance
σ². When called on a sample instead, this is the biased sample variance
s², also known as variance with N degrees of freedom. | trusted_official_docs | CPython Docs | .. note::
When called with the entire population, this gives the population variance
σ². When called on a sample instead, this is the biased sample variance
s², also known as variance with N degrees of freedom. | .. note::
When called with the entire population, this gives the population variance
σ². When called on a sample instead, this is the biased sample variance
s², also known as variance with N degrees of freedom. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
21462f38-aebe-4b67-ae5f-ee5fe7f8c52e | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,809 | supabase-export-v2 | d4f839404586ee21 | Generates *n* random samples for a given mean and standard deviation. Returns a :class:`list` of :class:`float` values.
If *seed* is given, creates a new instance of the underlying random
number generator. This is useful for creating reproducible results,
even in a multi-threading context. | trusted_official_docs | CPython Docs | Generates *n* random samples for a given mean and standard deviation. Returns a :class:`list` of :class:`float` values.
If *seed* is given, creates a new instance of the underlying random
number generator. This is useful for creating reproducible results,
even in a multi-threading context. | Generates *n* random samples for a given mean and standard deviation. Returns a :class:`list` of :class:`float` values.
If *seed* is given, creates a new instance of the underlying random
number generator. This is useful for creating reproducible results,
even in a multi-threading context. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
244378e4-0d3d-4e08-a300-6fb6f426f52d | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,819 | supabase-export-v2 | f221cf19588a2343 | distribution function, also known as the `quantile function <https://en.wikipedia.org/wiki/Quantile_function>`_ or the `percent-point <https://web.archive.org/web/20190203145224/https://www.statisticshowto.datasciencecentral.com/inverse-distribution-function/>`_ function. Mathematically, it is written ``x : P(X <= x) =... | trusted_official_docs | CPython Docs | distribution function, also known as the `quantile function <https://en.wikipedia.org/wiki/Quantile_function>`_ or the `percent-point <https://web.archive.org/web/20190203145224/https://www.statisticshowto.datasciencecentral.com/inverse-distribution-function/>`_ function. Mathematically, it is written ``x : P(X <= x) =... | distribution function, also known as the `quantile function <https://en.wikipedia.org/wiki/Quantile_function>`_ or the `percent-point <https://web.archive.org/web/20190203145224/https://www.statisticshowto.datasciencecentral.com/inverse-distribution-function/>`_ function. Mathematically, it is written ``x : P(X <= x) =... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2520fb0e-b1d3-461e-b5f5-c54bb77914e2 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,873 | supabase-export-v2 | 7eadfdc3ae4b76d3 | >>> 'male' if posterior_male > posterior_female else 'female' 'female'
.. # This modelines must appear within the last ten lines of the file. kate: indent-width 3; remove-trailing-space on; replace-tabs on; encoding utf-8; | trusted_official_docs | CPython Docs | >>> 'male' if posterior_male > posterior_female else 'female' 'female'
.. # This modelines must appear within the last ten lines of the file. kate: indent-width 3; remove-trailing-space on; replace-tabs on; encoding utf-8; | >>> 'male' if posterior_male > posterior_female else 'female' 'female'
.. # This modelines must appear within the last ten lines of the file. kate: indent-width 3; remove-trailing-space on; replace-tabs on; encoding utf-8; | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
256ed1f5-8f84-411c-8cdc-2c552c1cff12 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,807 | supabase-export-v2 | e39ee529e5e795d9 | least two elements, raises :exc:`StatisticsError` because it takes at least one point to estimate a central value and at least two points to estimate dispersion.
.. method:: NormalDist.samples(n, *, seed=None) | trusted_official_docs | CPython Docs | least two elements, raises :exc:`StatisticsError` because it takes at least one point to estimate a central value and at least two points to estimate dispersion.
.. method:: NormalDist.samples(n, *, seed=None) | least two elements, raises :exc:`StatisticsError` because it takes at least one point to estimate a central value and at least two points to estimate dispersion.
.. method:: NormalDist.samples(n, *, seed=None) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
26050628-f691-43a4-bbdb-096dfe60ef76 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,635 | supabase-export-v2 | cfc33164d2ebb960 | 1.9, 5.1, 6.2] >>> f_hat = kde(sample, h=1.5) >>> xarr = [i/100 for i in range(-750, 1100)] >>> yarr = [f_hat(x) for x in xarr]
The points in ``xarr`` and ``yarr`` can be used to make a PDF plot: | trusted_official_docs | CPython Docs | 1.9, 5.1, 6.2] >>> f_hat = kde(sample, h=1.5) >>> xarr = [i/100 for i in range(-750, 1100)] >>> yarr = [f_hat(x) for x in xarr]
The points in ``xarr`` and ``yarr`` can be used to make a PDF plot: | 1.9, 5.1, 6.2] >>> f_hat = kde(sample, h=1.5) >>> xarr = [i/100 for i in range(-750, 1100)] >>> yarr = [f_hat(x) for x in xarr]
The points in ``xarr`` and ``yarr`` can be used to make a PDF plot: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
28ae76f6-6df2-4c98-bd51-01ee00d3569f | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,732 | supabase-export-v2 | 32175ef1a8307a65 | >>> from decimal import Decimal as D >>> variance([D("27.5"), D("30.25"), D("30.25"), D("34.5"), D("41.75")]) Decimal('31.01875')
>>> from fractions import Fraction as F
>>> variance([F(1, 6), F(1, 2), F(5, 3)])
Fraction(67, 108) | trusted_official_docs | CPython Docs | >>> from decimal import Decimal as D >>> variance([D("27.5"), D("30.25"), D("30.25"), D("34.5"), D("41.75")]) Decimal('31.01875')
>>> from fractions import Fraction as F
>>> variance([F(1, 6), F(1, 2), F(5, 3)])
Fraction(67, 108) | >>> from decimal import Decimal as D >>> variance([D("27.5"), D("30.25"), D("30.25"), D("34.5"), D("41.75")]) Decimal('31.01875')
>>> from fractions import Fraction as F
>>> variance([F(1, 6), F(1, 2), F(5, 3)])
Fraction(67, 108) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2904312e-d012-4141-946a-95d07c9d666d | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,736 | supabase-export-v2 | 832cdea355a21faa | know the actual population mean μ you should pass it to the :func:`pvariance` function as the *mu* parameter to get the variance of a sample.
.. function:: quantiles(data, *, n=4, method='exclusive') | trusted_official_docs | CPython Docs | know the actual population mean μ you should pass it to the :func:`pvariance` function as the *mu* parameter to get the variance of a sample.
.. function:: quantiles(data, *, n=4, method='exclusive') | know the actual population mean μ you should pass it to the :func:`pvariance` function as the *mu* parameter to get the variance of a sample.
.. function:: quantiles(data, *, n=4, method='exclusive') | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2a2f6da9-989d-4804-9b8f-46025372bcba | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,632 | supabase-export-v2 | e4b7dcbd723c7bf8 | A :exc:`StatisticsError` will be raised if the *data* sequence is empty.
`Wikipedia has an example
<https://en.wikipedia.org/wiki/Kernel_density_estimation#Example>`_
where we can use :func:`kde` to generate and plot a probability
density function estimated from a small sample: | trusted_official_docs | CPython Docs | A :exc:`StatisticsError` will be raised if the *data* sequence is empty.
`Wikipedia has an example
<https://en.wikipedia.org/wiki/Kernel_density_estimation#Example>`_
where we can use :func:`kde` to generate and plot a probability
density function estimated from a small sample: | A :exc:`StatisticsError` will be raised if the *data* sequence is empty.
`Wikipedia has an example
<https://en.wikipedia.org/wiki/Kernel_density_estimation#Example>`_
where we can use :func:`kde` to generate and plot a probability
density function estimated from a small sample: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2b3f83aa-9d12-4d47-8f0c-a243b5d21a3c | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,713 | supabase-export-v2 | 16439a37078165e2 | population variance σ². When called on a sample instead, this is the biased sample variance s², also known as variance with N degrees of freedom.
If you somehow know the true population mean μ, you may use this
function to calculate the variance of a sample, giving the known
population mean as the second argument. Pr... | trusted_official_docs | CPython Docs | population variance σ². When called on a sample instead, this is the biased sample variance s², also known as variance with N degrees of freedom.
If you somehow know the true population mean μ, you may use this
function to calculate the variance of a sample, giving the known
population mean as the second argument. Pr... | population variance σ². When called on a sample instead, this is the biased sample variance s², also known as variance with N degrees of freedom.
If you somehow know the true population mean μ, you may use this
function to calculate the variance of a sample, giving the known
population mean as the second argument. Pr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2b58a262-5b5e-4592-aa27-4f3d5c19cb35 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,774 | supabase-export-v2 | da0eeee946c71723 | .. doctest::
>>> year = [1971, 1975, 1979, 1982, 1983]
>>> films_total = [1, 2, 3, 4, 5]
>>> slope, intercept = linear_regression(year, films_total)
>>> round(slope * 2019 + intercept)
16 | trusted_official_docs | CPython Docs | .. doctest::
>>> year = [1971, 1975, 1979, 1982, 1983]
>>> films_total = [1, 2, 3, 4, 5]
>>> slope, intercept = linear_regression(year, films_total)
>>> round(slope * 2019 + intercept)
16 | .. doctest::
>>> year = [1971, 1975, 1979, 1982, 1983]
>>> films_total = [1, 2, 3, 4, 5]
>>> slope, intercept = linear_regression(year, films_total)
>>> round(slope * 2019 + intercept)
16 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2c330208-bf2f-40a7-b5a0-06f5535ecaa8 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,846 | supabase-export-v2 | f574ec0295b634f1 | Monte Carlo inputs for simulations **********************************
To estimate the distribution for a model that isn't easy to solve
analytically, :class:`NormalDist` can generate input samples for a `Monte
Carlo simulation <https://en.wikipedia.org/wiki/Monte_Carlo_method>`_: | trusted_official_docs | CPython Docs | Monte Carlo inputs for simulations **********************************
To estimate the distribution for a model that isn't easy to solve
analytically, :class:`NormalDist` can generate input samples for a `Monte
Carlo simulation <https://en.wikipedia.org/wiki/Monte_Carlo_method>`_: | Monte Carlo inputs for simulations **********************************
To estimate the distribution for a model that isn't easy to solve
analytically, :class:`NormalDist` can generate input samples for a `Monte
Carlo simulation <https://en.wikipedia.org/wiki/Monte_Carlo_method>`_: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
32ae5673-46a3-4878-97f5-a8101a37a2e3 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,563 | supabase-export-v2 | 5062487409c2b154 | implementation-dependent. If your input data consists of mixed types, you may be able to use :func:`map` to ensure a consistent result, for example: ``map(float, input_data)``.
Some datasets use ``NaN`` (not a number) values to represent missing data. Since NaNs have unusual comparison semantics, they cause surprising ... | trusted_official_docs | CPython Docs | implementation-dependent. If your input data consists of mixed types, you may be able to use :func:`map` to ensure a consistent result, for example: ``map(float, input_data)``.
Some datasets use ``NaN`` (not a number) values to represent missing data. Since NaNs have unusual comparison semantics, they cause surprising ... | implementation-dependent. If your input data consists of mixed types, you may be able to use :func:`map` to ensure a consistent result, for example: ``map(float, input_data)``.
Some datasets use ``NaN`` (not a number) values to represent missing data. Since NaNs have unusual comparison semantics, they cause surprising ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
341267d4-b323-4046-95cb-b62a6ffb5547 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,666 | supabase-export-v2 | 0db8c02bf15f0e88 | Estimates the median for numeric data that has been `grouped or binned <https://en.wikipedia.org/wiki/Data_binning>`_ around the midpoints of consecutive, fixed-width intervals.
The *data* can be any iterable of numeric data with each value being
exactly the midpoint of a bin. At least one value must be present. | trusted_official_docs | CPython Docs | Estimates the median for numeric data that has been `grouped or binned <https://en.wikipedia.org/wiki/Data_binning>`_ around the midpoints of consecutive, fixed-width intervals.
The *data* can be any iterable of numeric data with each value being
exactly the midpoint of a bin. At least one value must be present. | Estimates the median for numeric data that has been `grouped or binned <https://en.wikipedia.org/wiki/Data_binning>`_ around the midpoints of consecutive, fixed-width intervals.
The *data* can be any iterable of numeric data with each value being
exactly the midpoint of a bin. At least one value must be present. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
351258e1-8d33-4946-ba02-2ab1bce1f925 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,720 | supabase-export-v2 | 74b3e91a8c1a9784 | or dispersion) of data. A large variance indicates that the data is spread out; a small variance indicates it is clustered closely around the mean.
If the optional second argument *xbar* is given, it should be the *sample*
mean of *data*. If it is missing or ``None`` (the default), the mean is
automatically calculate... | trusted_official_docs | CPython Docs | or dispersion) of data. A large variance indicates that the data is spread out; a small variance indicates it is clustered closely around the mean.
If the optional second argument *xbar* is given, it should be the *sample*
mean of *data*. If it is missing or ``None`` (the default), the mean is
automatically calculate... | or dispersion) of data. A large variance indicates that the data is spread out; a small variance indicates it is clustered closely around the mean.
If the optional second argument *xbar* is given, it should be the *sample*
mean of *data*. If it is missing or ``None`` (the default), the mean is
automatically calculate... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
358ccea9-baa4-4dc2-9cd4-8d0fcbb1f8f6 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,613 | supabase-export-v2 | 0b6a448c73ab61ce | a type of average, a measure of the central location of the data. It is often appropriate when averaging ratios or rates, for example speeds.
Suppose a car travels 10 km at 40 km/hr, then another 10 km at 60 km/hr. What is the average speed? | trusted_official_docs | CPython Docs | a type of average, a measure of the central location of the data. It is often appropriate when averaging ratios or rates, for example speeds.
Suppose a car travels 10 km at 40 km/hr, then another 10 km at 60 km/hr. What is the average speed? | a type of average, a measure of the central location of the data. It is often appropriate when averaging ratios or rates, for example speeds.
Suppose a car travels 10 km at 40 km/hr, then another 10 km at 60 km/hr. What is the average speed? | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
39405ea0-76d6-4d91-a137-62c3ae7cca47 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,728 | supabase-export-v2 | c0a32f8d0680260c | >>> m = mean(data) >>> variance(data, m) 1.3720238095238095
This function does not attempt to verify that you have passed the actual mean
as *xbar*. Using arbitrary values for *xbar* can lead to invalid or
impossible results. | trusted_official_docs | CPython Docs | >>> m = mean(data) >>> variance(data, m) 1.3720238095238095
This function does not attempt to verify that you have passed the actual mean
as *xbar*. Using arbitrary values for *xbar* can lead to invalid or
impossible results. | >>> m = mean(data) >>> variance(data, m) 1.3720238095238095
This function does not attempt to verify that you have passed the actual mean
as *xbar*. Using arbitrary values for *xbar* can lead to invalid or
impossible results. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3a4038e2-e8ea-4c57-a9f8-f26356f8bdf9 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,768 | supabase-export-v2 | 83d86673731a12d8 | .. function:: linear_regression(x, y, /, *, proportional=False)
Return the slope and intercept of `simple linear regression
<https://en.wikipedia.org/wiki/Simple_linear_regression>`_
parameters estimated using ordinary least squares. Simple linear
regression describes the relationship between an independent variable... | trusted_official_docs | CPython Docs | .. function:: linear_regression(x, y, /, *, proportional=False)
Return the slope and intercept of `simple linear regression
<https://en.wikipedia.org/wiki/Simple_linear_regression>`_
parameters estimated using ordinary least squares. Simple linear
regression describes the relationship between an independent variable... | .. function:: linear_regression(x, y, /, *, proportional=False)
Return the slope and intercept of `simple linear regression
<https://en.wikipedia.org/wiki/Simple_linear_regression>`_
parameters estimated using ordinary least squares. Simple linear
regression describes the relationship between an independent variable... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3b3cf009-3e95-4cfe-a5da-b6e4642400e2 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,588 | supabase-export-v2 | 93f5330dc26ae8fc | .. note::
The mean is strongly affected by `outliers
<https://en.wikipedia.org/wiki/Outlier>`_ and is not necessarily a
typical example of the data points. For a more robust, although less
efficient, measure of `central tendency
<https://en.wikipedia.org/wiki/Central_tendency>`_, see :func:`median`. | trusted_official_docs | CPython Docs | .. note::
The mean is strongly affected by `outliers
<https://en.wikipedia.org/wiki/Outlier>`_ and is not necessarily a
typical example of the data points. For a more robust, although less
efficient, measure of `central tendency
<https://en.wikipedia.org/wiki/Central_tendency>`_, see :func:`median`. | .. note::
The mean is strongly affected by `outliers
<https://en.wikipedia.org/wiki/Outlier>`_ and is not necessarily a
typical example of the data points. For a more robust, although less
efficient, measure of `central tendency
<https://en.wikipedia.org/wiki/Central_tendency>`_, see :func:`median`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3d9b43a7-eff8-46f7-bc10-a503b25f38a6 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,853 | supabase-export-v2 | 0eb81202fa69ad2c | .. doctest::
>>> n = 750 # Sample size
>>> p = 0.65 # Preference for Python
>>> q = 1.0 - p # Preference for Ruby
>>> k = 500 # Room capacity | trusted_official_docs | CPython Docs | .. doctest::
>>> n = 750 # Sample size
>>> p = 0.65 # Preference for Python
>>> q = 1.0 - p # Preference for Ruby
>>> k = 500 # Room capacity | .. doctest::
>>> n = 750 # Sample size
>>> p = 0.65 # Preference for Python
>>> q = 1.0 - p # Preference for Ruby
>>> k = 500 # Room capacity | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3edd8b25-1189-4c82-af2a-55cf534d7059 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,725 | supabase-export-v2 | 3e34aa6fba645bad | >>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5] >>> variance(data) 1.3720238095238095
If you have already calculated the sample mean of your data, you can pass it
as the optional second argument *xbar* to avoid recalculation: | trusted_official_docs | CPython Docs | >>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5] >>> variance(data) 1.3720238095238095
If you have already calculated the sample mean of your data, you can pass it
as the optional second argument *xbar* to avoid recalculation: | >>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5] >>> variance(data) 1.3720238095238095
If you have already calculated the sample mean of your data, you can pass it
as the optional second argument *xbar* to avoid recalculation: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3ee31a72-228a-4d52-bf77-d3480001ba52 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,775 | supabase-export-v2 | 6d7a54d66e6cfa0e | 1975, 1979, 1982, 1983] >>> films_total = [1, 2, 3, 4, 5] >>> slope, intercept = linear_regression(year, films_total) >>> round(slope * 2019 + intercept) 16
If *proportional* is true, the independent variable *x* and the
dependent variable *y* are assumed to be directly proportional. The data is fit to a line passing ... | trusted_official_docs | CPython Docs | 1975, 1979, 1982, 1983] >>> films_total = [1, 2, 3, 4, 5] >>> slope, intercept = linear_regression(year, films_total) >>> round(slope * 2019 + intercept) 16
If *proportional* is true, the independent variable *x* and the
dependent variable *y* are assumed to be directly proportional. The data is fit to a line passing ... | 1975, 1979, 1982, 1983] >>> films_total = [1, 2, 3, 4, 5] >>> slope, intercept = linear_regression(year, films_total) >>> round(slope * 2019 + intercept) 16
If *proportional* is true, the independent variable *x* and the
dependent variable *y* are assumed to be directly proportional. The data is fit to a line passing ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
412da956-83c4-4d49-85f2-fa715e4828ca | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,752 | supabase-export-v2 | ed17708fa2ecfb51 | .. doctest::
>>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> y = [1, 2, 3, 1, 2, 3, 1, 2, 3]
>>> covariance(x, y)
0.75
>>> z = [9, 8, 7, 6, 5, 4, 3, 2, 1]
>>> covariance(x, z)
-7.5
>>> covariance(z, x)
-7.5 | trusted_official_docs | CPython Docs | .. doctest::
>>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> y = [1, 2, 3, 1, 2, 3, 1, 2, 3]
>>> covariance(x, y)
0.75
>>> z = [9, 8, 7, 6, 5, 4, 3, 2, 1]
>>> covariance(x, z)
-7.5
>>> covariance(z, x)
-7.5 | .. doctest::
>>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> y = [1, 2, 3, 1, 2, 3, 1, 2, 3]
>>> covariance(x, y)
0.75
>>> z = [9, 8, 7, 6, 5, 4, 3, 2, 1]
>>> covariance(x, z)
-7.5
>>> covariance(z, x)
-7.5 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
42e62fcb-72e7-41b4-939b-7cfaa390ddf9 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,585 | supabase-export-v2 | a56c57f3a271ce1a | >>> mean([1, 2, 3, 4, 4]) 2.8 >>> mean([-1.0, 2.5, 3.25, 5.75]) 2.625
>>> from fractions import Fraction as F
>>> mean([F(3, 7), F(1, 21), F(5, 3), F(1, 3)])
Fraction(13, 21) | trusted_official_docs | CPython Docs | >>> mean([1, 2, 3, 4, 4]) 2.8 >>> mean([-1.0, 2.5, 3.25, 5.75]) 2.625
>>> from fractions import Fraction as F
>>> mean([F(3, 7), F(1, 21), F(5, 3), F(1, 3)])
Fraction(13, 21) | >>> mean([1, 2, 3, 4, 4]) 2.8 >>> mean([-1.0, 2.5, 3.25, 5.75]) 2.625
>>> from fractions import Fraction as F
>>> mean([F(3, 7), F(1, 21), F(5, 3), F(1, 3)])
Fraction(13, 21) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
47c3d3f3-67ab-4045-9781-76ff579b0cbd | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,611 | supabase-export-v2 | cb671febd60a46e1 | Return the harmonic mean of *data*, a sequence or iterable of real-valued numbers. If *weights* is omitted or ``None``, then equal weighting is assumed.
The harmonic mean is the reciprocal of the arithmetic :func:`mean` of the
reciprocals of the data. For example, the harmonic mean of three values *a*,
*b* and *c* wi... | trusted_official_docs | CPython Docs | Return the harmonic mean of *data*, a sequence or iterable of real-valued numbers. If *weights* is omitted or ``None``, then equal weighting is assumed.
The harmonic mean is the reciprocal of the arithmetic :func:`mean` of the
reciprocals of the data. For example, the harmonic mean of three values *a*,
*b* and *c* wi... | Return the harmonic mean of *data*, a sequence or iterable of real-valued numbers. If *weights* is omitted or ``None``, then equal weighting is assumed.
The harmonic mean is the reciprocal of the arithmetic :func:`mean` of the
reciprocals of the data. For example, the harmonic mean of three values *a*,
*b* and *c* wi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4b082f83-dd93-4871-bf3a-d82c2df2e241 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,683 | supabase-export-v2 | 54af2dc2322fcf05 | >>> mode([1, 1, 2, 3, 3, 3, 3, 4]) 3
The mode is unique in that it is the only statistic in this package that
also applies to nominal (non-numeric) data: | trusted_official_docs | CPython Docs | >>> mode([1, 1, 2, 3, 3, 3, 3, 4]) 3
The mode is unique in that it is the only statistic in this package that
also applies to nominal (non-numeric) data: | >>> mode([1, 1, 2, 3, 3, 3, 3, 4]) 3
The mode is unique in that it is the only statistic in this package that
also applies to nominal (non-numeric) data: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4d0034bb-9763-4664-8065-d1815d6e49bc | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,564 | supabase-export-v2 | a745683203c40057 | that count occurrences. The functions affected are ``median()``, ``median_low()``, ``median_high()``, ``median_grouped()``, ``mode()``, ``multimode()``, and ``quantiles()``. The ``NaN`` values should be stripped before calling these functions::
>>> from statistics import median
>>> from math import isnan
>>> from ite... | trusted_official_docs | CPython Docs | that count occurrences. The functions affected are ``median()``, ``median_low()``, ``median_high()``, ``median_grouped()``, ``mode()``, ``multimode()``, and ``quantiles()``. The ``NaN`` values should be stripped before calling these functions::
>>> from statistics import median
>>> from math import isnan
>>> from ite... | that count occurrences. The functions affected are ``median()``, ``median_low()``, ``median_high()``, ``median_grouped()``, ``mode()``, ``multimode()``, and ``quantiles()``. The ``NaN`` values should be stripped before calling these functions::
>>> from statistics import median
>>> from math import isnan
>>> from ite... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
503d5aa4-907e-4d61-a0be-c8b06082bdc0 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,667 | supabase-export-v2 | 509501c176ef90ba | *data* can be any iterable of numeric data with each value being exactly the midpoint of a bin. At least one value must be present.
The *interval* is the width of each bin. | trusted_official_docs | CPython Docs | *data* can be any iterable of numeric data with each value being exactly the midpoint of a bin. At least one value must be present.
The *interval* is the width of each bin. | *data* can be any iterable of numeric data with each value being exactly the midpoint of a bin. At least one value must be present.
The *interval* is the width of each bin. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
51697a27-b11c-4c12-a7bf-fa2de7e7cb5b | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,806 | supabase-export-v2 | 9ce4cede38c952f7 | Makes a normal distribution instance with *mu* and *sigma* parameters estimated from the *data* using :func:`fmean` and :func:`stdev`.
The *data* can be any :term:`iterable` and should consist of values
that can be converted to type :class:`float`. If *data* does not
contain at least two elements, raises :exc:`Statis... | trusted_official_docs | CPython Docs | Makes a normal distribution instance with *mu* and *sigma* parameters estimated from the *data* using :func:`fmean` and :func:`stdev`.
The *data* can be any :term:`iterable` and should consist of values
that can be converted to type :class:`float`. If *data* does not
contain at least two elements, raises :exc:`Statis... | Makes a normal distribution instance with *mu* and *sigma* parameters estimated from the *data* using :func:`fmean` and :func:`stdev`.
The *data* can be any :term:`iterable` and should consist of values
that can be converted to type :class:`float`. If *data* does not
contain at least two elements, raises :exc:`Statis... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
51ee94c5-c363-4661-b0e5-82b2a2517df1 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,589 | supabase-export-v2 | b728a497f4bad9a3 | and is not necessarily a typical example of the data points. For a more robust, although less efficient, measure of `central tendency <https://en.wikipedia.org/wiki/Central_tendency>`_, see :func:`median`.
The sample mean gives an unbiased estimate of the true population mean,
so that when taken on average over all th... | trusted_official_docs | CPython Docs | and is not necessarily a typical example of the data points. For a more robust, although less efficient, measure of `central tendency <https://en.wikipedia.org/wiki/Central_tendency>`_, see :func:`median`.
The sample mean gives an unbiased estimate of the true population mean,
so that when taken on average over all th... | and is not necessarily a typical example of the data points. For a more robust, although less efficient, measure of `central tendency <https://en.wikipedia.org/wiki/Central_tendency>`_, see :func:`median`.
The sample mean gives an unbiased estimate of the true population mean,
so that when taken on average over all th... | 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.