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
65abc194-61a8-4ec5-a31e-5489961d9312
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,223
supabase-export-v2
2d2d842ea2d0e062
as the main thread exits, all threads are killed. Your main thread is running too quickly, giving the threads no time to do any work. A simple fix is to add a sleep to the end of the program that's long enough for all the threads to finish::
trusted_official_docs
CPython Docs
as the main thread exits, all threads are killed. Your main thread is running too quickly, giving the threads no time to do any work. A simple fix is to add a sleep to the end of the program that's long enough for all the threads to finish::
as the main thread exits, all threads are killed. Your main thread is running too quickly, giving the threads no time to do any work. A simple fix is to add a sleep to the end of the program that's long enough for all the threads to finish::
python, official-docs, cpython, P0
Local_Trusted_Corpus
69af13a1-e323-4804-907e-58e93322014d
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,201
supabase-export-v2
92864ebe10214cf4
at the bottom of the main module of your program. Once your program is organized as a tractable collection of function and class behaviours, you should write test functions that exercise the behaviours. A test suite that automates a sequence of tests can be associated with each module. This sounds like a lot of work, b...
trusted_official_docs
CPython Docs
at the bottom of the main module of your program. Once your program is organized as a tractable collection of function and class behaviours, you should write test functions that exercise the behaviours. A test suite that automates a sequence of tests can be associated with each module. This sounds like a lot of work, b...
at the bottom of the main module of your program. Once your program is organized as a tractable collection of function and class behaviours, you should write test functions that exercise the behaviours. A test suite that automates a sequence of tests can be associated with each module. This sounds like a lot of work, b...
python, official-docs, cpython, P0
Local_Trusted_Corpus
6d88f708-b08b-4b88-a91e-9a1a82a561e5
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,278
supabase-export-v2
c9cf26a670a65d63
format string forces big-endian data; the letter 'h' reads one "short integer" (2 bytes), and 'l' reads one "long integer" (4 bytes) from the string. For data that is more regular (e.g. a homogeneous list of ints or floats), you can also use the :mod:`array` module.
trusted_official_docs
CPython Docs
format string forces big-endian data; the letter 'h' reads one "short integer" (2 bytes), and 'l' reads one "long integer" (4 bytes) from the string. For data that is more regular (e.g. a homogeneous list of ints or floats), you can also use the :mod:`array` module.
format string forces big-endian data; the letter 'h' reads one "short integer" (2 bytes), and 'l' reads one "long integer" (4 bytes) from the string. For data that is more regular (e.g. a homogeneous list of ints or floats), you can also use the :mod:`array` module.
python, official-docs, cpython, P0
Local_Trusted_Corpus
6dd60804-f238-4452-abd1-62d30f45b915
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,247
supabase-export-v2
4aa1947d3f957f84
started 130283807619344)> running with argument 3 Worker <Thread(worker 5, started 130283799226640)> running with argument 4 Worker <Thread(worker 1, started 130283832797456)> running with argument 5 ... Consult the module's documentation for more details; the :class:`~queue.Queue` class provides a featureful interface...
trusted_official_docs
CPython Docs
started 130283807619344)> running with argument 3 Worker <Thread(worker 5, started 130283799226640)> running with argument 4 Worker <Thread(worker 1, started 130283832797456)> running with argument 5 ... Consult the module's documentation for more details; the :class:`~queue.Queue` class provides a featureful interface...
started 130283807619344)> running with argument 3 Worker <Thread(worker 5, started 130283799226640)> running with argument 4 Worker <Thread(worker 1, started 130283832797456)> running with argument 5 ... Consult the module's documentation for more details; the :class:`~queue.Queue` class provides a featureful interface...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7450b772-d309-4357-90c8-faee4dbbe16e
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,316
supabase-export-v2
8103c14d136d8af0
:meth:`~socket.socket.connect_ex` again later -- ``0`` or ``errno.EISCONN`` indicate that you're connected -- or you can pass this socket to :meth:`select.select` to check if it's writable. .. note:: The :mod:`asyncio` module provides a general purpose single-threaded and concurrent asynchronous library, which can be...
trusted_official_docs
CPython Docs
:meth:`~socket.socket.connect_ex` again later -- ``0`` or ``errno.EISCONN`` indicate that you're connected -- or you can pass this socket to :meth:`select.select` to check if it's writable. .. note:: The :mod:`asyncio` module provides a general purpose single-threaded and concurrent asynchronous library, which can be...
:meth:`~socket.socket.connect_ex` again later -- ``0`` or ``errno.EISCONN`` indicate that you're connected -- or you can pass this socket to :meth:`select.select` to check if it's writable. .. note:: The :mod:`asyncio` module provides a general purpose single-threaded and concurrent asynchronous library, which can be...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7def762c-4de7-4186-a1d9-b7f41d2bb64c
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,298
supabase-export-v2
e59175433e711965
the chapters titled :ref:`internet` and :ref:`netdata` in the Library Reference Manual. Python has many modules that will help you build server-side and client-side web systems. .. XXX check if wiki page is still up to date
trusted_official_docs
CPython Docs
the chapters titled :ref:`internet` and :ref:`netdata` in the Library Reference Manual. Python has many modules that will help you build server-side and client-side web systems. .. XXX check if wiki page is still up to date
the chapters titled :ref:`internet` and :ref:`netdata` in the Library Reference Manual. Python has many modules that will help you build server-side and client-side web systems. .. XXX check if wiki page is still up to date
python, official-docs, cpython, P0
Local_Trusted_Corpus
7f6a4b2d-218a-4c3c-b8df-72fc1c394be9
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,277
supabase-export-v2
638fa123c0724d80
with open(filename, "rb") as f: s = f.read(8) x, y, z = struct.unpack(">hhl", s) The '>' in the format string forces big-endian data; the letter 'h' reads one "short integer" (2 bytes), and 'l' reads one "long integer" (4 bytes) from the string.
trusted_official_docs
CPython Docs
with open(filename, "rb") as f: s = f.read(8) x, y, z = struct.unpack(">hhl", s) The '>' in the format string forces big-endian data; the letter 'h' reads one "short integer" (2 bytes), and 'l' reads one "long integer" (4 bytes) from the string.
with open(filename, "rb") as f: s = f.read(8) x, y, z = struct.unpack(">hhl", s) The '>' in the format string forces big-endian data; the letter 'h' reads one "short integer" (2 bytes), and 'l' reads one "long integer" (4 bytes) from the string.
python, official-docs, cpython, P0
Local_Trusted_Corpus
849d1516-64cd-40ab-b9ba-1791fce645a1
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,184
supabase-export-v2
b66b8fa901196da9
.. XXX curses *is* built by default, isn't it? For Unix variants: The standard Python source distribution comes with a curses module in the :source:`Modules` subdirectory, though it's not compiled by default. (Note that this is not available in the Windows distribution -- there is no curses module for Windows.)
trusted_official_docs
CPython Docs
.. XXX curses *is* built by default, isn't it? For Unix variants: The standard Python source distribution comes with a curses module in the :source:`Modules` subdirectory, though it's not compiled by default. (Note that this is not available in the Windows distribution -- there is no curses module for Windows.)
.. XXX curses *is* built by default, isn't it? For Unix variants: The standard Python source distribution comes with a curses module in the :source:`Modules` subdirectory, though it's not compiled by default. (Note that this is not available in the Windows distribution -- there is no curses module for Windows.)
python, official-docs, cpython, P0
Local_Trusted_Corpus
85032a0d-cfd3-4b0b-acdc-d853fa30fc51
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,221
supabase-export-v2
565074798a041998
the :mod:`threading` module and not the :mod:`_thread` module. The :mod:`threading` module builds convenient abstractions on top of the low-level primitives provided by the :mod:`_thread` module. None of my threads seem to run: why? ------------------------------------
trusted_official_docs
CPython Docs
the :mod:`threading` module and not the :mod:`_thread` module. The :mod:`threading` module builds convenient abstractions on top of the low-level primitives provided by the :mod:`_thread` module. None of my threads seem to run: why? ------------------------------------
the :mod:`threading` module and not the :mod:`_thread` module. The :mod:`threading` module builds convenient abstractions on top of the low-level primitives provided by the :mod:`_thread` module. None of my threads seem to run: why? ------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
861d3bc5-6926-4b9c-b1b8-999b4eb0522e
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,163
supabase-export-v2
b4936923c920e957
`Google <https://www.google.com>`_ or another web search engine. Searching for "Python" plus a keyword or two for your topic of interest will usually find something helpful. Where is the math.py (socket.py, regex.py, etc.) source file? -------------------------------------------------------------
trusted_official_docs
CPython Docs
`Google <https://www.google.com>`_ or another web search engine. Searching for "Python" plus a keyword or two for your topic of interest will usually find something helpful. Where is the math.py (socket.py, regex.py, etc.) source file? -------------------------------------------------------------
`Google <https://www.google.com>`_ or another web search engine. Searching for "Python" plus a keyword or two for your topic of interest will usually find something helpful. Where is the math.py (socket.py, regex.py, etc.) source file? -------------------------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
86bf58ae-871f-49f0-ba96-98d749eeff84
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,323
supabase-export-v2
9ae6160b7f430247
How do you implement persistent objects in Python? -------------------------------------------------- The :mod:`pickle` library module solves this in a very general way (though you still can't store things like open files, sockets or windows), and the :mod:`shelve` library module uses pickle and (g)dbm to create persis...
trusted_official_docs
CPython Docs
How do you implement persistent objects in Python? -------------------------------------------------- The :mod:`pickle` library module solves this in a very general way (though you still can't store things like open files, sockets or windows), and the :mod:`shelve` library module uses pickle and (g)dbm to create persis...
How do you implement persistent objects in Python? -------------------------------------------------- The :mod:`pickle` library module solves this in a very general way (though you still can't store things like open files, sockets or windows), and the :mod:`shelve` library module uses pickle and (g)dbm to create persis...
python, official-docs, cpython, P0
Local_Trusted_Corpus
901d2f1c-8e08-4a42-a3ca-610d0f6b8ae0
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,282
supabase-export-v2
06cdb3352e0f2e85
I can't seem to use os.read() on a pipe created with os.popen(); why? --------------------------------------------------------------------- :func:`os.read` is a low-level function which takes a file descriptor, a small integer representing the opened file. :func:`os.popen` creates a high-level file object, the same typ...
trusted_official_docs
CPython Docs
I can't seem to use os.read() on a pipe created with os.popen(); why? --------------------------------------------------------------------- :func:`os.read` is a low-level function which takes a file descriptor, a small integer representing the opened file. :func:`os.popen` creates a high-level file object, the same typ...
I can't seem to use os.read() on a pipe created with os.popen(); why? --------------------------------------------------------------------- :func:`os.read` is a low-level function which takes a file descriptor, a small integer representing the opened file. :func:`os.popen` creates a high-level file object, the same typ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
90fd5d15-e79b-4f89-86a4-72310cbf5a90
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,196
supabase-export-v2
48000712cbaf7016
The :mod:`doctest` module finds examples in the docstrings for a module and runs them, comparing the output with the expected output given in the docstring. The :mod:`unittest` module is a fancier testing framework modelled on Java and Smalltalk testing frameworks.
trusted_official_docs
CPython Docs
The :mod:`doctest` module finds examples in the docstrings for a module and runs them, comparing the output with the expected output given in the docstring. The :mod:`unittest` module is a fancier testing framework modelled on Java and Smalltalk testing frameworks.
The :mod:`doctest` module finds examples in the docstrings for a module and runs them, comparing the output with the expected output given in the docstring. The :mod:`unittest` module is a fancier testing framework modelled on Java and Smalltalk testing frameworks.
python, official-docs, cpython, P0
Local_Trusted_Corpus
9eb5801c-4859-416a-ab30-575bdf98a08c
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,315
supabase-export-v2
921a5f9883582a98
is in progress, but hasn't finished yet. Different OSes will return different values, so you're going to have to check what's returned on your system. You can use the :meth:`~socket.socket.connect_ex` method to avoid creating an exception. It will just return the errno value. To poll, you can call :meth:`~socket.socket...
trusted_official_docs
CPython Docs
is in progress, but hasn't finished yet. Different OSes will return different values, so you're going to have to check what's returned on your system. You can use the :meth:`~socket.socket.connect_ex` method to avoid creating an exception. It will just return the errno value. To poll, you can call :meth:`~socket.socket...
is in progress, but hasn't finished yet. Different OSes will return different values, so you're going to have to check what's returned on your system. You can use the :meth:`~socket.socket.connect_ex` method to avoid creating an exception. It will just return the errno value. To poll, you can call :meth:`~socket.socket...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a06393d9-963b-42a2-ac58-4b305929659f
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,280
supabase-export-v2
18169a47efea6ccb
.. note:: To read and write binary data, it is mandatory to open the file in binary mode (here, passing ``"rb"`` to :func:`open`). If you use ``"r"`` instead (the default), the file will be open in text mode and ``f.read()`` will return :class:`str` objects rather than :class:`bytes` objects.
trusted_official_docs
CPython Docs
.. note:: To read and write binary data, it is mandatory to open the file in binary mode (here, passing ``"rb"`` to :func:`open`). If you use ``"r"`` instead (the default), the file will be open in text mode and ``f.read()`` will return :class:`str` objects rather than :class:`bytes` objects.
.. note:: To read and write binary data, it is mandatory to open the file in binary mode (here, passing ``"rb"`` to :func:`open`). If you use ``"r"`` instead (the default), the file will be open in text mode and ``f.read()`` will return :class:`str` objects rather than :class:`bytes` objects.
python, official-docs, cpython, P0
Local_Trusted_Corpus
a0e70c78-858a-42d1-8cc8-9a46ddf244bc
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,217
supabase-export-v2
dbd3e4291a112b85
descriptor flags and modify them for non-blocking mode. Since reading stdin when it is empty results in an :exc:`OSError`, this error is caught and ignored. .. versionchanged:: 3.3 *sys.stdin.read* used to raise :exc:`IOError`. Starting from Python 3.3 :exc:`IOError` is alias for :exc:`OSError`.
trusted_official_docs
CPython Docs
descriptor flags and modify them for non-blocking mode. Since reading stdin when it is empty results in an :exc:`OSError`, this error is caught and ignored. .. versionchanged:: 3.3 *sys.stdin.read* used to raise :exc:`IOError`. Starting from Python 3.3 :exc:`IOError` is alias for :exc:`OSError`.
descriptor flags and modify them for non-blocking mode. Since reading stdin when it is empty results in an :exc:`OSError`, this error is caught and ignored. .. versionchanged:: 3.3 *sys.stdin.read* used to raise :exc:`IOError`. Starting from Python 3.3 :exc:`IOError` is alias for :exc:`OSError`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
a9908ec7-6c99-4f3e-b9d9-335b0a86ab85
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,265
supabase-export-v2
deb654ee826e3cf1
How do I delete a file? (And other file questions...) ----------------------------------------------------- Use ``os.remove(filename)`` or ``os.unlink(filename)``; for documentation, see the :mod:`os` module. The two functions are identical; :func:`~os.unlink` is simply the name of the Unix system call for this functio...
trusted_official_docs
CPython Docs
How do I delete a file? (And other file questions...) ----------------------------------------------------- Use ``os.remove(filename)`` or ``os.unlink(filename)``; for documentation, see the :mod:`os` module. The two functions are identical; :func:`~os.unlink` is simply the name of the Unix system call for this functio...
How do I delete a file? (And other file questions...) ----------------------------------------------------- Use ``os.remove(filename)`` or ``os.unlink(filename)``; for documentation, see the :mod:`os` module. The two functions are identical; :func:`~os.unlink` is simply the name of the Unix system call for this functio...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ab49c66d-105c-402b-a1a9-0817977d024e
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,260
supabase-export-v2
6dfd6e3c0b60010b
to compensate for the removal of the GIL. The Python 3.9 fork is the first attempt at removing the GIL with an acceptable performance impact. The presence of the GIL in current Python releases doesn't mean that you can't make good use of Python on multi-CPU machines! You just have to be creative with dividing the work ...
trusted_official_docs
CPython Docs
to compensate for the removal of the GIL. The Python 3.9 fork is the first attempt at removing the GIL with an acceptable performance impact. The presence of the GIL in current Python releases doesn't mean that you can't make good use of Python on multi-CPU machines! You just have to be creative with dividing the work ...
to compensate for the removal of the GIL. The Python 3.9 fork is the first attempt at removing the GIL with an acceptable performance impact. The presence of the GIL in current Python releases doesn't mean that you can't make good use of Python on multi-CPU machines! You just have to be creative with dividing the work ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ae7b475b-09d6-434d-9695-c8dac2091d56
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,252
supabase-export-v2
b0552a90555c2a22
example, the following operations are all atomic (L, L1, L2 are lists, D, D1, D2 are dicts, x, y are objects, i, j are ints):: L.append(x) L1.extend(L2) x = L[i] x = L.pop() L1[i:j] = L2 L.sort() x = y x.field = y D[x] = y D1.update(D2) D.keys()
trusted_official_docs
CPython Docs
example, the following operations are all atomic (L, L1, L2 are lists, D, D1, D2 are dicts, x, y are objects, i, j are ints):: L.append(x) L1.extend(L2) x = L[i] x = L.pop() L1[i:j] = L2 L.sort() x = y x.field = y D[x] = y D1.update(D2) D.keys()
example, the following operations are all atomic (L, L1, L2 are lists, D, D1, D2 are dicts, x, y are objects, i, j are ints):: L.append(x) L1.extend(L2) x = L[i] x = L.pop() L1[i:j] = L2 L.sort() x = y x.field = y D[x] = y D1.update(D2) D.keys()
python, official-docs, cpython, P0
Local_Trusted_Corpus
af6ffbd7-37be-443d-b264-28f87d87590b
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,251
supabase-export-v2
dd0f1978e9f401f1
PVM bytecode implementation. In practice, it means that operations on shared variables of built-in data types (ints, lists, dicts, etc) that "look atomic" really are. For example, the following operations are all atomic (L, L1, L2 are lists, D, D1, D2 are dicts, x, y are objects, i, j are ints)::
trusted_official_docs
CPython Docs
PVM bytecode implementation. In practice, it means that operations on shared variables of built-in data types (ints, lists, dicts, etc) that "look atomic" really are. For example, the following operations are all atomic (L, L1, L2 are lists, D, D1, D2 are dicts, x, y are objects, i, j are ints)::
PVM bytecode implementation. In practice, it means that operations on shared variables of built-in data types (ints, lists, dicts, etc) that "look atomic" really are. For example, the following operations are all atomic (L, L1, L2 are lists, D, D1, D2 are dicts, x, y are objects, i, j are ints)::
python, official-docs, cpython, P0
Local_Trusted_Corpus
b1577586-612e-4d57-8c70-9fbc65b5dac1
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,174
supabase-export-v2
aa29e05e29f2d287
as the very first line of your file, using the pathname for where the Python interpreter is installed on your platform. If you would like the script to be independent of where the Python interpreter lives, you can use the :program:`env` program. Almost all Unix variants support the following, assuming the Python interp...
trusted_official_docs
CPython Docs
as the very first line of your file, using the pathname for where the Python interpreter is installed on your platform. If you would like the script to be independent of where the Python interpreter lives, you can use the :program:`env` program. Almost all Unix variants support the following, assuming the Python interp...
as the very first line of your file, using the pathname for where the Python interpreter is installed on your platform. If you would like the script to be independent of where the Python interpreter lives, you can use the :program:`env` program. Almost all Unix variants support the following, assuming the Python interp...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b3719488-b94e-43bf-a587-a6c4fddff06a
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,240
supabase-export-v2
297d242be5300b5c
while True: try: arg = q.get(block=False) except queue.Empty: print('Worker', threading.current_thread(), end=' ') print('queue empty') break else: print('Worker', threading.current_thread(), end=' ') print('running with argument', arg) time.sleep(0.5) # Create queue q = queue.Queue()
trusted_official_docs
CPython Docs
while True: try: arg = q.get(block=False) except queue.Empty: print('Worker', threading.current_thread(), end=' ') print('queue empty') break else: print('Worker', threading.current_thread(), end=' ') print('running with argument', arg) time.sleep(0.5) # Create queue q = queue.Queue()
while True: try: arg = q.get(block=False) except queue.Empty: print('Worker', threading.current_thread(), end=' ') print('queue empty') break else: print('Worker', threading.current_thread(), end=' ') print('running with argument', arg) time.sleep(0.5) # Create queue q = queue.Queue()
python, official-docs, cpython, P0
Local_Trusted_Corpus
bc13edd7-7f35-4cad-bbb5-3da5ebc0e81f
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,272
supabase-export-v2
76fde9310a28f368
both are now rarely used. It also doesn't copy file permissions and metadata, though using :func:`shutil.copy2` instead will preserve most (though not all) of it. How do I read (or write) binary data? -------------------------------------
trusted_official_docs
CPython Docs
both are now rarely used. It also doesn't copy file permissions and metadata, though using :func:`shutil.copy2` instead will preserve most (though not all) of it. How do I read (or write) binary data? -------------------------------------
both are now rarely used. It also doesn't copy file permissions and metadata, though using :func:`shutil.copy2` instead will preserve most (though not all) of it. How do I read (or write) binary data? -------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
bda2776c-f25c-455a-a2f9-a778b139c04c
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,205
supabase-export-v2
5e53cbf768e11a24
Even programs that interact with complex external interfaces may be tested when the external interfaces are unavailable by using "fake" interfaces implemented in Python. How do I create documentation from doc strings? -----------------------------------------------
trusted_official_docs
CPython Docs
Even programs that interact with complex external interfaces may be tested when the external interfaces are unavailable by using "fake" interfaces implemented in Python. How do I create documentation from doc strings? -----------------------------------------------
Even programs that interact with complex external interfaces may be tested when the external interfaces are unavailable by using "fake" interfaces implemented in Python. How do I create documentation from doc strings? -----------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
bf8c7b6a-f690-47af-80e1-deb50370e0c9
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,331
supabase-export-v2
f4514583fa5297d8
in the range [a, b). * ``uniform(a, b)`` chooses a floating-point number in the range [a, b). * ``normalvariate(mean, sdev)`` samples the normal (Gaussian) distribution. Some higher-level functions operate on sequences directly, such as:
trusted_official_docs
CPython Docs
in the range [a, b). * ``uniform(a, b)`` chooses a floating-point number in the range [a, b). * ``normalvariate(mean, sdev)`` samples the normal (Gaussian) distribution. Some higher-level functions operate on sequences directly, such as:
in the range [a, b). * ``uniform(a, b)`` chooses a floating-point number in the range [a, b). * ``normalvariate(mean, sdev)`` samples the normal (Gaussian) distribution. Some higher-level functions operate on sequences directly, such as:
python, official-docs, cpython, P0
Local_Trusted_Corpus
c290c9c0-c382-4e34-9ae6-2f5e0f66401c
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,271
supabase-export-v2
39ae1c5ebf4a359f
How do I copy a file? --------------------- The :mod:`shutil` module contains a :func:`~shutil.copyfile` function. Note that on Windows NTFS volumes, it does not copy `alternate data streams <https://en.wikipedia.org/wiki/NTFS#Alternate_data_stream_(ADS)>`_ nor `resource forks <https://en.wikipedia.org/wiki/Resource_fo...
trusted_official_docs
CPython Docs
How do I copy a file? --------------------- The :mod:`shutil` module contains a :func:`~shutil.copyfile` function. Note that on Windows NTFS volumes, it does not copy `alternate data streams <https://en.wikipedia.org/wiki/NTFS#Alternate_data_stream_(ADS)>`_ nor `resource forks <https://en.wikipedia.org/wiki/Resource_fo...
How do I copy a file? --------------------- The :mod:`shutil` module contains a :func:`~shutil.copyfile` function. Note that on Windows NTFS volumes, it does not copy `alternate data streams <https://en.wikipedia.org/wiki/NTFS#Alternate_data_stream_(ADS)>`_ nor `resource forks <https://en.wikipedia.org/wiki/Resource_fo...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c2a0e167-1bee-46b2-b097-34e66d6d900a
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,269
supabase-export-v2
3800164b24823346
offset defaults to the current seek position. There's also ``os.ftruncate(fd, offset)`` for files opened with :func:`os.open`, where *fd* is the file descriptor (a small integer). The :mod:`shutil` module also contains a number of functions to work on files including :func:`~shutil.copyfile`, :func:`~shutil.copytree`, ...
trusted_official_docs
CPython Docs
offset defaults to the current seek position. There's also ``os.ftruncate(fd, offset)`` for files opened with :func:`os.open`, where *fd* is the file descriptor (a small integer). The :mod:`shutil` module also contains a number of functions to work on files including :func:`~shutil.copyfile`, :func:`~shutil.copytree`, ...
offset defaults to the current seek position. There's also ``os.ftruncate(fd, offset)`` for files opened with :func:`os.open`, where *fd* is the file descriptor (a small integer). The :mod:`shutil` module also contains a number of functions to work on files including :func:`~shutil.copyfile`, :func:`~shutil.copytree`, ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c48d0749-5f76-49f0-bba9-959ccea2ce4c
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,185
supabase-export-v2
8c76f0aa82482c50
subdirectory, though it's not compiled by default. (Note that this is not available in the Windows distribution -- there is no curses module for Windows.) The :mod:`curses` module supports basic curses features as well as many additional functions from ncurses and SYSV curses such as colour, alternative character set s...
trusted_official_docs
CPython Docs
subdirectory, though it's not compiled by default. (Note that this is not available in the Windows distribution -- there is no curses module for Windows.) The :mod:`curses` module supports basic curses features as well as many additional functions from ncurses and SYSV curses such as colour, alternative character set s...
subdirectory, though it's not compiled by default. (Note that this is not available in the Windows distribution -- there is no curses module for Windows.) The :mod:`curses` module supports basic curses features as well as many additional functions from ncurses and SYSV curses such as colour, alternative character set s...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ca67e78c-4172-4909-925b-a6a6d05101a9
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,220
supabase-export-v2
900306f0b7d64bb5
How do I program using threads? ------------------------------- Be sure to use the :mod:`threading` module and not the :mod:`_thread` module. The :mod:`threading` module builds convenient abstractions on top of the low-level primitives provided by the :mod:`_thread` module.
trusted_official_docs
CPython Docs
How do I program using threads? ------------------------------- Be sure to use the :mod:`threading` module and not the :mod:`_thread` module. The :mod:`threading` module builds convenient abstractions on top of the low-level primitives provided by the :mod:`_thread` module.
How do I program using threads? ------------------------------- Be sure to use the :mod:`threading` module and not the :mod:`_thread` module. The :mod:`threading` module builds convenient abstractions on top of the low-level primitives provided by the :mod:`_thread` module.
python, official-docs, cpython, P0
Local_Trusted_Corpus
cb7835c9-8cc9-426f-bb21-69dca8e9d24e
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,222
supabase-export-v2
7ef05ad9c475ad71
None of my threads seem to run: why? ------------------------------------ As soon as the main thread exits, all threads are killed. Your main thread is running too quickly, giving the threads no time to do any work.
trusted_official_docs
CPython Docs
None of my threads seem to run: why? ------------------------------------ As soon as the main thread exits, all threads are killed. Your main thread is running too quickly, giving the threads no time to do any work.
None of my threads seem to run: why? ------------------------------------ As soon as the main thread exits, all threads are killed. Your main thread is running too quickly, giving the threads no time to do any work.
python, official-docs, cpython, P0
Local_Trusted_Corpus
ccae3aa8-054f-470a-8bec-002323d71455
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,228
supabase-export-v2
c8eac3d52c23273c
time.sleep(10) # <---------------------------! But now (on many platforms) the threads don't run in parallel, but appear to run sequentially, one at a time! The reason is that the OS thread scheduler doesn't start a new thread until the previous thread is blocked.
trusted_official_docs
CPython Docs
time.sleep(10) # <---------------------------! But now (on many platforms) the threads don't run in parallel, but appear to run sequentially, one at a time! The reason is that the OS thread scheduler doesn't start a new thread until the previous thread is blocked.
time.sleep(10) # <---------------------------! But now (on many platforms) the threads don't run in parallel, but appear to run sequentially, one at a time! The reason is that the OS thread scheduler doesn't start a new thread until the previous thread is blocked.
python, official-docs, cpython, P0
Local_Trusted_Corpus
d4629747-87a9-41ce-8aed-0668bc0fc2c4
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,236
supabase-export-v2
d290735752f3b593
The easiest way is to use the :mod:`concurrent.futures` module, especially the :mod:`~concurrent.futures.ThreadPoolExecutor` class. Or, if you want fine control over the dispatching algorithm, you can write your own logic manually. Use the :mod:`queue` module to create a queue containing a list of jobs. The :class:`~qu...
trusted_official_docs
CPython Docs
The easiest way is to use the :mod:`concurrent.futures` module, especially the :mod:`~concurrent.futures.ThreadPoolExecutor` class. Or, if you want fine control over the dispatching algorithm, you can write your own logic manually. Use the :mod:`queue` module to create a queue containing a list of jobs. The :class:`~qu...
The easiest way is to use the :mod:`concurrent.futures` module, especially the :mod:`~concurrent.futures.ThreadPoolExecutor` class. Or, if you want fine control over the dispatching algorithm, you can write your own logic manually. Use the :mod:`queue` module to create a queue containing a list of jobs. The :class:`~qu...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d8039c14-2790-40d9-928b-e3f55353f22c
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,198
supabase-export-v2
6f5bb7646e580307
accesses are faster than global accesses). Furthermore the program should avoid depending on mutating global variables, since this makes testing much more difficult to do. The "global main logic" of your program may be as simple as ::
trusted_official_docs
CPython Docs
accesses are faster than global accesses). Furthermore the program should avoid depending on mutating global variables, since this makes testing much more difficult to do. The "global main logic" of your program may be as simple as ::
accesses are faster than global accesses). Furthermore the program should avoid depending on mutating global variables, since this makes testing much more difficult to do. The "global main logic" of your program may be as simple as ::
python, official-docs, cpython, P0
Local_Trusted_Corpus
dadb7bae-5766-437b-9287-61106e34fe0b
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,256
supabase-export-v2
b7be65f762c2a62b
reaches zero, and that can affect things. This is especially true for the mass updates to dictionaries and lists. When in doubt, use a mutex! Can't we get rid of the Global Interpreter Lock? ------------------------------------------------
trusted_official_docs
CPython Docs
reaches zero, and that can affect things. This is especially true for the mass updates to dictionaries and lists. When in doubt, use a mutex! Can't we get rid of the Global Interpreter Lock? ------------------------------------------------
reaches zero, and that can affect things. This is especially true for the mass updates to dictionaries and lists. When in doubt, use a mutex! Can't we get rid of the Global Interpreter Lock? ------------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
e5563948-fde7-41ab-8a36-e3a200a4c4bb
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,290
supabase-export-v2
b9b87605164294c9
Python :term:`file objects <file object>` are a high-level layer of abstraction on low-level C file descriptors. For most file objects you create in Python via the built-in :func:`open` function, ``f.close()`` marks the Python file object as being closed from Python's point of view, and also arranges to close the under...
trusted_official_docs
CPython Docs
Python :term:`file objects <file object>` are a high-level layer of abstraction on low-level C file descriptors. For most file objects you create in Python via the built-in :func:`open` function, ``f.close()`` marks the Python file object as being closed from Python's point of view, and also arranges to close the under...
Python :term:`file objects <file object>` are a high-level layer of abstraction on low-level C file descriptors. For most file objects you create in Python via the built-in :func:`open` function, ``f.close()`` marks the Python file object as being closed from Python's point of view, and also arranges to close the under...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e71ff08c-b3d8-4557-bc85-d084b5b02f59
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,274
supabase-export-v2
dd3b002705af947b
use the :mod:`struct` module. It allows you to take a string containing binary data (usually numbers) and convert it to Python objects; and vice versa. For example, the following code reads two 2-byte integers and one 4-byte integer in big-endian format from a file::
trusted_official_docs
CPython Docs
use the :mod:`struct` module. It allows you to take a string containing binary data (usually numbers) and convert it to Python objects; and vice versa. For example, the following code reads two 2-byte integers and one 4-byte integer in big-endian format from a file::
use the :mod:`struct` module. It allows you to take a string containing binary data (usually numbers) and convert it to Python objects; and vice versa. For example, the following code reads two 2-byte integers and one 4-byte integer in big-endian format from a file::
python, official-docs, cpython, P0
Local_Trusted_Corpus
ec8f71a6-33d3-4ccc-aea6-da98fabe1fd2
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,162
supabase-export-v2
bea9c3a09efe29f0
to see if there's a relevant standard library module. (Eventually you'll learn what's in the standard library and will be able to skip this step.) For third-party packages, search the `Python Package Index <https://pypi.org>`_ or try `Google <https://www.google.com>`_ or another web search engine. Searching for "Python...
trusted_official_docs
CPython Docs
to see if there's a relevant standard library module. (Eventually you'll learn what's in the standard library and will be able to skip this step.) For third-party packages, search the `Python Package Index <https://pypi.org>`_ or try `Google <https://www.google.com>`_ or another web search engine. Searching for "Python...
to see if there's a relevant standard library module. (Eventually you'll learn what's in the standard library and will be able to skip this step.) For third-party packages, search the `Python Package Index <https://pypi.org>`_ or try `Google <https://www.google.com>`_ or another web search engine. Searching for "Python...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ecf538d3-6d09-400e-8ede-2b744d4cf2d0
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,216
supabase-export-v2
32d6402b805a98eb
work, and I've only tried it on Linux, though it should work elsewhere. In this code, characters are read and printed one at a time. :func:`termios.tcsetattr` turns off stdin's echoing and disables canonical mode. :func:`fcntl.fnctl` is used to obtain stdin's file descriptor flags and modify them for non-blocking mod...
trusted_official_docs
CPython Docs
work, and I've only tried it on Linux, though it should work elsewhere. In this code, characters are read and printed one at a time. :func:`termios.tcsetattr` turns off stdin's echoing and disables canonical mode. :func:`fcntl.fnctl` is used to obtain stdin's file descriptor flags and modify them for non-blocking mod...
work, and I've only tried it on Linux, though it should work elsewhere. In this code, characters are read and printed one at a time. :func:`termios.tcsetattr` turns off stdin's echoing and disables canonical mode. :func:`fcntl.fnctl` is used to obtain stdin's file descriptor flags and modify them for non-blocking mod...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ef164a2f-8b24-4a20-a094-2bb716bbc2ac
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,170
supabase-export-v2
0894df40542c4d06
two things: the script file's mode must be executable and the first line must begin with ``#!`` followed by the path of the Python interpreter. The first is done by executing ``chmod +x scriptfile`` or perhaps ``chmod 755 scriptfile``.
trusted_official_docs
CPython Docs
two things: the script file's mode must be executable and the first line must begin with ``#!`` followed by the path of the Python interpreter. The first is done by executing ``chmod +x scriptfile`` or perhaps ``chmod 755 scriptfile``.
two things: the script file's mode must be executable and the first line must begin with ``#!`` followed by the path of the Python interpreter. The first is done by executing ``chmod +x scriptfile`` or perhaps ``chmod 755 scriptfile``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
f26abbb6-a1aa-4e1c-bbcc-1948d4febc06
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,311
supabase-export-v2
8a5091b700d669f6
import os SENDMAIL = "/usr/sbin/sendmail" # sendmail location p = os.popen("%s -t -i" % SENDMAIL, "w") p.write("To: receiver@example.com\n") p.write("Subject: test\n") p.write("\n") # blank line separating headers from body p.write("Some text\n") p.write("some more text\n") sts = p.close() if sts != 0: print("...
trusted_official_docs
CPython Docs
import os SENDMAIL = "/usr/sbin/sendmail" # sendmail location p = os.popen("%s -t -i" % SENDMAIL, "w") p.write("To: receiver@example.com\n") p.write("Subject: test\n") p.write("\n") # blank line separating headers from body p.write("Some text\n") p.write("some more text\n") sts = p.close() if sts != 0: print("...
import os SENDMAIL = "/usr/sbin/sendmail" # sendmail location p = os.popen("%s -t -i" % SENDMAIL, "w") p.write("To: receiver@example.com\n") p.write("Subject: test\n") p.write("\n") # blank line separating headers from body p.write("Some text\n") p.write("some more text\n") sts = p.close() if sts != 0: print("...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f370b829-be58-40e8-b697-5f948c0b2569
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,177
supabase-export-v2
d9c5661ddd4f448c
for CGI scripts. The :envvar:`PATH` variable for CGI scripts is often very minimal, so you need to use the actual absolute pathname of the interpreter. Occasionally, a user's environment is so full that the :program:`/usr/bin/env` program fails; or there's no env program at all. In that case, you can try the following ...
trusted_official_docs
CPython Docs
for CGI scripts. The :envvar:`PATH` variable for CGI scripts is often very minimal, so you need to use the actual absolute pathname of the interpreter. Occasionally, a user's environment is so full that the :program:`/usr/bin/env` program fails; or there's no env program at all. In that case, you can try the following ...
for CGI scripts. The :envvar:`PATH` variable for CGI scripts is often very minimal, so you need to use the actual absolute pathname of the interpreter. Occasionally, a user's environment is so full that the :program:`/usr/bin/env` program fails; or there's no env program at all. In that case, you can try the following ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f384132f-4f13-4037-a6fd-96be98265ee8
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,169
supabase-export-v2
f906594054802495
How do I make a Python script executable on Unix? ------------------------------------------------- You need to do two things: the script file's mode must be executable and the first line must begin with ``#!`` followed by the path of the Python interpreter.
trusted_official_docs
CPython Docs
How do I make a Python script executable on Unix? ------------------------------------------------- You need to do two things: the script file's mode must be executable and the first line must begin with ``#!`` followed by the path of the Python interpreter.
How do I make a Python script executable on Unix? ------------------------------------------------- You need to do two things: the script file's mode must be executable and the first line must begin with ``#!`` followed by the path of the Python interpreter.
python, official-docs, cpython, P0
Local_Trusted_Corpus
f4e33e6e-1397-4f98-b630-afe8376d28e8
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,273
supabase-export-v2
f3927ecef452291f
How do I read (or write) binary data? ------------------------------------- To read or write complex binary data formats, it's best to use the :mod:`struct` module. It allows you to take a string containing binary data (usually numbers) and convert it to Python objects; and vice versa.
trusted_official_docs
CPython Docs
How do I read (or write) binary data? ------------------------------------- To read or write complex binary data formats, it's best to use the :mod:`struct` module. It allows you to take a string containing binary data (usually numbers) and convert it to Python objects; and vice versa.
How do I read (or write) binary data? ------------------------------------- To read or write complex binary data formats, it's best to use the :mod:`struct` module. It allows you to take a string containing binary data (usually numbers) and convert it to Python objects; and vice versa.
python, official-docs, cpython, P0
Local_Trusted_Corpus
f5f34133-5536-4046-af20-bf45a3345c63
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,246
supabase-export-v2
4251f942a6ae36b1
.. code-block:: none Running worker Running worker Running worker Running worker Running worker Main thread sleeping Worker <Thread(worker 1, started 130283832797456)> running with argument 0 Worker <Thread(worker 2, started 130283824404752)> running with argument 1 Worker <Thread(worker 3, started 130283816012...
trusted_official_docs
CPython Docs
.. code-block:: none Running worker Running worker Running worker Running worker Running worker Main thread sleeping Worker <Thread(worker 1, started 130283832797456)> running with argument 0 Worker <Thread(worker 2, started 130283824404752)> running with argument 1 Worker <Thread(worker 3, started 130283816012...
.. code-block:: none Running worker Running worker Running worker Running worker Running worker Main thread sleeping Worker <Thread(worker 1, started 130283832797456)> running with argument 0 Worker <Thread(worker 2, started 130283824404752)> running with argument 1 Worker <Thread(worker 3, started 130283816012...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f8f42083-088e-46d8-8a54-91ab4c12fc3b
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,171
supabase-export-v2
89640218abc92c36
The first is done by executing ``chmod +x scriptfile`` or perhaps ``chmod 755 scriptfile``. The second can be done in a number of ways. The most straightforward way is to write ::
trusted_official_docs
CPython Docs
The first is done by executing ``chmod +x scriptfile`` or perhaps ``chmod 755 scriptfile``. The second can be done in a number of ways. The most straightforward way is to write ::
The first is done by executing ``chmod +x scriptfile`` or perhaps ``chmod 755 scriptfile``. The second can be done in a number of ways. The most straightforward way is to write ::
python, official-docs, cpython, P0
Local_Trusted_Corpus
fae24025-23b3-4c9e-9a0f-a487a8602ea4
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,292
supabase-export-v2
ee964da129788101
also given to them by C. Running ``sys.stdout.close()`` marks the Python-level file object as being closed, but does *not* close the associated C file descriptor. To close the underlying C file descriptor for one of these three, you should first be sure that's what you really want to do (e.g., you may confuse extension...
trusted_official_docs
CPython Docs
also given to them by C. Running ``sys.stdout.close()`` marks the Python-level file object as being closed, but does *not* close the associated C file descriptor. To close the underlying C file descriptor for one of these three, you should first be sure that's what you really want to do (e.g., you may confuse extension...
also given to them by C. Running ``sys.stdout.close()`` marks the Python-level file object as being closed, but does *not* close the associated C file descriptor. To close the underlying C file descriptor for one of these three, you should first be sure that's what you really want to do (e.g., you may confuse extension...
python, official-docs, cpython, P0
Local_Trusted_Corpus
fd13b0cc-1ff6-4ad0-ad58-bffd550ddae9
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,268
supabase-export-v2
3b96ca7a43d33c0f
To rename a file, use ``os.rename(old_path, new_path)``. To truncate a file, open it using ``f = open(filename, "rb+")``, and use ``f.truncate(offset)``; offset defaults to the current seek position. There's also ``os.ftruncate(fd, offset)`` for files opened with :func:`os.open`, where *fd* is the file descriptor (a sm...
trusted_official_docs
CPython Docs
To rename a file, use ``os.rename(old_path, new_path)``. To truncate a file, open it using ``f = open(filename, "rb+")``, and use ``f.truncate(offset)``; offset defaults to the current seek position. There's also ``os.ftruncate(fd, offset)`` for files opened with :func:`os.open`, where *fd* is the file descriptor (a sm...
To rename a file, use ``os.rename(old_path, new_path)``. To truncate a file, open it using ``f = open(filename, "rb+")``, and use ``f.truncate(offset)``; offset defaults to the current seek position. There's also ``os.ftruncate(fd, offset)`` for files opened with :func:`os.open`, where *fd* is the file descriptor (a sm...
python, official-docs, cpython, P0
Local_Trusted_Corpus
fdcb3abb-72b4-445a-8622-c8a1b6bc038b
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,197
supabase-export-v2
38981cfe2de3d172
The :mod:`unittest` module is a fancier testing framework modelled on Java and Smalltalk testing frameworks. To make testing easier, you should use good modular design in your program. Your program should have almost all functionality encapsulated in either functions or class methods -- and this sometimes has the surpr...
trusted_official_docs
CPython Docs
The :mod:`unittest` module is a fancier testing framework modelled on Java and Smalltalk testing frameworks. To make testing easier, you should use good modular design in your program. Your program should have almost all functionality encapsulated in either functions or class methods -- and this sometimes has the surpr...
The :mod:`unittest` module is a fancier testing framework modelled on Java and Smalltalk testing frameworks. To make testing easier, you should use good modular design in your program. Your program should have almost all functionality encapsulated in either functions or class methods -- and this sometimes has the surpr...
python, official-docs, cpython, P0
Local_Trusted_Corpus
fe018b60-cfd9-4f69-8cc2-77cc1c8f64ac
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,321
supabase-export-v2
9865ca77a81ea4ce
as :mod:`DBM <dbm.ndbm>` and :mod:`GDBM <dbm.gnu>` are also included with standard Python. There is also the :mod:`sqlite3` module, which provides a lightweight disk-based relational database. Support for most relational databases is available. See the `DatabaseProgramming wiki page <https://wiki.python.org/moin/Databa...
trusted_official_docs
CPython Docs
as :mod:`DBM <dbm.ndbm>` and :mod:`GDBM <dbm.gnu>` are also included with standard Python. There is also the :mod:`sqlite3` module, which provides a lightweight disk-based relational database. Support for most relational databases is available. See the `DatabaseProgramming wiki page <https://wiki.python.org/moin/Databa...
as :mod:`DBM <dbm.ndbm>` and :mod:`GDBM <dbm.gnu>` are also included with standard Python. There is also the :mod:`sqlite3` module, which provides a lightweight disk-based relational database. Support for most relational databases is available. See the `DatabaseProgramming wiki page <https://wiki.python.org/moin/Databa...
python, official-docs, cpython, P0
Local_Trusted_Corpus
03fd35cc-437c-4b34-851d-1a58d5eb9035
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,428
supabase-export-v2
5bc52e07e66a3d68
If you want to force Python to delete certain things on deallocation use the :mod:`atexit` module to run a function that will force those deletions. Why are there separate tuple and list data types? -------------------------------------------------
trusted_official_docs
CPython Docs
If you want to force Python to delete certain things on deallocation use the :mod:`atexit` module to run a function that will force those deletions. Why are there separate tuple and list data types? -------------------------------------------------
If you want to force Python to delete certain things on deallocation use the :mod:`atexit` module to run a function that will force those deletions. Why are there separate tuple and list data types? -------------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
050cd603-2476-4183-9320-2743f1dc67c9
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,413
supabase-export-v2
a21f231340fac689
Can Python be compiled to machine code, C or some other language? ----------------------------------------------------------------- `Cython <https://cython.org/>`_ compiles a modified version of Python with optional annotations into C extensions. `Nuitka <https://nuitka.net/>`_ is an up-and-coming compiler of Python in...
trusted_official_docs
CPython Docs
Can Python be compiled to machine code, C or some other language? ----------------------------------------------------------------- `Cython <https://cython.org/>`_ compiles a modified version of Python with optional annotations into C extensions. `Nuitka <https://nuitka.net/>`_ is an up-and-coming compiler of Python in...
Can Python be compiled to machine code, C or some other language? ----------------------------------------------------------------- `Cython <https://cython.org/>`_ compiles a modified version of Python with optional annotations into C extensions. `Nuitka <https://nuitka.net/>`_ is an up-and-coming compiler of Python in...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0869b1f4-7a04-4e0b-ad05-6bba486f790f
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,395
supabase-export-v2
f006dbeab69a7427
if key in mydict: value = mydict[key] else: value = mydict[key] = getvalue(key) For this specific case, you could also use ``value = dict.setdefault(key, getvalue(key))``, but only if the ``getvalue()`` call is cheap enough because it is evaluated in all cases.
trusted_official_docs
CPython Docs
if key in mydict: value = mydict[key] else: value = mydict[key] = getvalue(key) For this specific case, you could also use ``value = dict.setdefault(key, getvalue(key))``, but only if the ``getvalue()`` call is cheap enough because it is evaluated in all cases.
if key in mydict: value = mydict[key] else: value = mydict[key] = getvalue(key) For this specific case, you could also use ``value = dict.setdefault(key, getvalue(key))``, but only if the ``getvalue()`` call is cheap enough because it is evaluated in all cases.
python, official-docs, cpython, P0
Local_Trusted_Corpus
0cc23991-bf2a-4458-8c47-cd9d94111aea
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,462
supabase-export-v2
d0c72824929b09b1
the prototypes for the methods and functions of the module. Many feel that compile-time enforcement of interface specifications helps in the construction of large programs. Python 2.6 adds an :mod:`abc` module that lets you define Abstract Base Classes (ABCs). You can then use :func:`isinstance` and :func:`issubclass` ...
trusted_official_docs
CPython Docs
the prototypes for the methods and functions of the module. Many feel that compile-time enforcement of interface specifications helps in the construction of large programs. Python 2.6 adds an :mod:`abc` module that lets you define Abstract Base Classes (ABCs). You can then use :func:`isinstance` and :func:`issubclass` ...
the prototypes for the methods and functions of the module. Many feel that compile-time enforcement of interface specifications helps in the construction of large programs. Python 2.6 adds an :mod:`abc` module that lets you define Abstract Base Classes (ABCs). You can then use :func:`isinstance` and :func:`issubclass` ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0ded0ea9-de54-46f6-ab38-7f29ced300d2
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,420
supabase-export-v2
1f6555b15c2851fb
``f`` closes the previous file. With a traditional GC, however, those file objects will only get collected (and closed) at varying and possibly long intervals. If you want to write code that will work with any Python implementation, you should explicitly close the file or use the :keyword:`with` statement; this will wo...
trusted_official_docs
CPython Docs
``f`` closes the previous file. With a traditional GC, however, those file objects will only get collected (and closed) at varying and possibly long intervals. If you want to write code that will work with any Python implementation, you should explicitly close the file or use the :keyword:`with` statement; this will wo...
``f`` closes the previous file. With a traditional GC, however, those file objects will only get collected (and closed) at varying and possibly long intervals. If you want to write code that will work with any Python implementation, you should explicitly close the file or use the :keyword:`with` statement; this will wo...
python, official-docs, cpython, P0
Local_Trusted_Corpus
10ecf81c-51e7-46b4-9afe-55eb3ee40a67
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,348
supabase-export-v2
cde94b222c3d01d6
>>> 1.2 - 1.0 0.19999999999999996 and think it is a bug in Python. It's not. This has little to do with Python, and much more to do with how the underlying platform handles floating-point numbers.
trusted_official_docs
CPython Docs
>>> 1.2 - 1.0 0.19999999999999996 and think it is a bug in Python. It's not. This has little to do with Python, and much more to do with how the underlying platform handles floating-point numbers.
>>> 1.2 - 1.0 0.19999999999999996 and think it is a bug in Python. It's not. This has little to do with Python, and much more to do with how the underlying platform handles floating-point numbers.
python, official-docs, cpython, P0
Local_Trusted_Corpus
18cc53d3-bf84-4c1d-9d19-09f2a62dab3c
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,391
supabase-export-v2
e008614cc5a901da
How fast are exceptions? ------------------------ A :keyword:`try`/:keyword:`except` block is extremely efficient if no exceptions are raised. Actually catching an exception is expensive. In versions of Python prior to 2.0 it was common to use this idiom::
trusted_official_docs
CPython Docs
How fast are exceptions? ------------------------ A :keyword:`try`/:keyword:`except` block is extremely efficient if no exceptions are raised. Actually catching an exception is expensive. In versions of Python prior to 2.0 it was common to use this idiom::
How fast are exceptions? ------------------------ A :keyword:`try`/:keyword:`except` block is extremely efficient if no exceptions are raised. Actually catching an exception is expensive. In versions of Python prior to 2.0 it was common to use this idiom::
python, official-docs, cpython, P0
Local_Trusted_Corpus
197ff463-6d5c-40ac-8c81-793b1a57041c
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,415
supabase-export-v2
42570c404a09e9af
How does Python manage memory? ------------------------------ The details of Python memory management depend on the implementation. The standard implementation of Python, :term:`CPython`, uses reference counting to detect inaccessible objects, and another mechanism to collect reference cycles, periodically executing a ...
trusted_official_docs
CPython Docs
How does Python manage memory? ------------------------------ The details of Python memory management depend on the implementation. The standard implementation of Python, :term:`CPython`, uses reference counting to detect inaccessible objects, and another mechanism to collect reference cycles, periodically executing a ...
How does Python manage memory? ------------------------------ The details of Python memory management depend on the implementation. The standard implementation of Python, :term:`CPython`, uses reference counting to detect inaccessible objects, and another mechanism to collect reference cycles, periodically executing a ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1c8c86ba-33fe-4c4a-9d0d-513670ccc3bc
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,394
supabase-export-v2
f17ebf81f8827c43
made sense when you expected the dict to have the key almost all the time. If that wasn't the case, you coded it like this:: if key in mydict: value = mydict[key] else: value = mydict[key] = getvalue(key)
trusted_official_docs
CPython Docs
made sense when you expected the dict to have the key almost all the time. If that wasn't the case, you coded it like this:: if key in mydict: value = mydict[key] else: value = mydict[key] = getvalue(key)
made sense when you expected the dict to have the key almost all the time. If that wasn't the case, you coded it like this:: if key in mydict: value = mydict[key] else: value = mydict[key] = getvalue(key)
python, official-docs, cpython, P0
Local_Trusted_Corpus
1da91bd0-05ba-4f5c-8a65-2a048991d218
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,494
supabase-export-v2
eeafd70ff7c7961e
side-effect of increasing execution speed because name bindings are resolved at run-time in Python, and the second version only needs to perform the resolution once. Similar proposals that would introduce syntax to further reduce code volume, such as using a 'leading dot', have been rejected in favour of explicitness (...
trusted_official_docs
CPython Docs
side-effect of increasing execution speed because name bindings are resolved at run-time in Python, and the second version only needs to perform the resolution once. Similar proposals that would introduce syntax to further reduce code volume, such as using a 'leading dot', have been rejected in favour of explicitness (...
side-effect of increasing execution speed because name bindings are resolved at run-time in Python, and the second version only needs to perform the resolution once. Similar proposals that would introduce syntax to further reduce code volume, such as using a 'leading dot', have been rejected in favour of explicitness (...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1ee87b28-b612-48bf-9ee8-178a01ccb102
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,421
supabase-export-v2
86f7d474ee063445
will work with any Python implementation, you should explicitly close the file or use the :keyword:`with` statement; this will work regardless of memory management scheme:: for file in very_long_list_of_files: with open(file) as f: c = f.read(1)
trusted_official_docs
CPython Docs
will work with any Python implementation, you should explicitly close the file or use the :keyword:`with` statement; this will work regardless of memory management scheme:: for file in very_long_list_of_files: with open(file) as f: c = f.read(1)
will work with any Python implementation, you should explicitly close the file or use the :keyword:`with` statement; this will work regardless of memory management scheme:: for file in very_long_list_of_files: with open(file) as f: c = f.read(1)
python, official-docs, cpython, P0
Local_Trusted_Corpus
1f635297-a9fd-44bd-97c2-9240f444ee77
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,410
supabase-export-v2
1e90fe6ada3b7b9a
Why can't lambda expressions contain statements? ------------------------------------------------ Python lambda expressions cannot contain statements because Python's syntactic framework can't handle statements nested inside expressions. However, in Python, this is not a serious problem. Unlike lambda forms in other la...
trusted_official_docs
CPython Docs
Why can't lambda expressions contain statements? ------------------------------------------------ Python lambda expressions cannot contain statements because Python's syntactic framework can't handle statements nested inside expressions. However, in Python, this is not a serious problem. Unlike lambda forms in other la...
Why can't lambda expressions contain statements? ------------------------------------------------ Python lambda expressions cannot contain statements because Python's syntactic framework can't handle statements nested inside expressions. However, in Python, this is not a serious problem. Unlike lambda forms in other la...
python, official-docs, cpython, P0
Local_Trusted_Corpus
20fb9f2d-db5d-494e-b131-a1cf36d6bf97
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,407
supabase-export-v2
bb610c7838620fa3
Can't you emulate threads in the interpreter instead of relying on an OS-specific thread implementation? -------------------------------------------------------------------------------------------------------- Answer 1: Unfortunately, the interpreter pushes at least one C stack frame for each Python stack frame. Also, ...
trusted_official_docs
CPython Docs
Can't you emulate threads in the interpreter instead of relying on an OS-specific thread implementation? -------------------------------------------------------------------------------------------------------- Answer 1: Unfortunately, the interpreter pushes at least one C stack frame for each Python stack frame. Also, ...
Can't you emulate threads in the interpreter instead of relying on an OS-specific thread implementation? -------------------------------------------------------------------------------------------------------- Answer 1: Unfortunately, the interpreter pushes at least one C stack frame for each Python stack frame. Also, ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
21b18c06-ef98-4608-9284-6eee5604c5f8
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,429
supabase-export-v2
de41d60913666127
Why are there separate tuple and list data types? ------------------------------------------------- Lists and tuples, while similar in many respects, are generally used in fundamentally different ways. Tuples can be thought of as being similar to Pascal ``records`` or C ``structs``; they're small collections of related...
trusted_official_docs
CPython Docs
Why are there separate tuple and list data types? ------------------------------------------------- Lists and tuples, while similar in many respects, are generally used in fundamentally different ways. Tuples can be thought of as being similar to Pascal ``records`` or C ``structs``; they're small collections of related...
Why are there separate tuple and list data types? ------------------------------------------------- Lists and tuples, while similar in many respects, are generally used in fundamentally different ways. Tuples can be thought of as being similar to Pascal ``records`` or C ``structs``; they're small collections of related...
python, official-docs, cpython, P0
Local_Trusted_Corpus
23534c04-f6dd-4bcd-a769-80a431f46086
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,338
supabase-export-v2
ce49e02fc3c8da39
is extremely elegant and contributes a lot to the clarity of the average Python program. Most people learn to love this feature after a while. Since there are no begin/end brackets there cannot be a disagreement between grouping perceived by the parser and the human reader. Occasionally C programmers will encounter a f...
trusted_official_docs
CPython Docs
is extremely elegant and contributes a lot to the clarity of the average Python program. Most people learn to love this feature after a while. Since there are no begin/end brackets there cannot be a disagreement between grouping perceived by the parser and the human reader. Occasionally C programmers will encounter a f...
is extremely elegant and contributes a lot to the clarity of the average Python program. Most people learn to love this feature after a while. Since there are no begin/end brackets there cannot be a disagreement between grouping perceived by the parser and the human reader. Occasionally C programmers will encounter a f...
python, official-docs, cpython, P0
Local_Trusted_Corpus
239df299-9103-49d6-a540-c2a14039ad1e
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,352
supabase-export-v2
42f3d2724fc5d4b4
>>> x = 1.2 the value stored for ``x`` is a (very good) approximation to the decimal value ``1.2``, but is not exactly equal to it. On a typical machine, the actual stored value is::
trusted_official_docs
CPython Docs
>>> x = 1.2 the value stored for ``x`` is a (very good) approximation to the decimal value ``1.2``, but is not exactly equal to it. On a typical machine, the actual stored value is::
>>> x = 1.2 the value stored for ``x`` is a (very good) approximation to the decimal value ``1.2``, but is not exactly equal to it. On a typical machine, the actual stored value is::
python, official-docs, cpython, P0
Local_Trusted_Corpus
24b0b080-c383-4719-95f1-8d07acea5850
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,423
supabase-export-v2
21445cc3aef11fe6
Why doesn't CPython use a more traditional garbage collection scheme? --------------------------------------------------------------------- For one thing, this is not a C standard feature and hence it's not portable. (Yes, we know about the Boehm GC library. It has bits of assembler code for *most* common platforms, no...
trusted_official_docs
CPython Docs
Why doesn't CPython use a more traditional garbage collection scheme? --------------------------------------------------------------------- For one thing, this is not a C standard feature and hence it's not portable. (Yes, we know about the Boehm GC library. It has bits of assembler code for *most* common platforms, no...
Why doesn't CPython use a more traditional garbage collection scheme? --------------------------------------------------------------------- For one thing, this is not a C standard feature and hence it's not portable. (Yes, we know about the Boehm GC library. It has bits of assembler code for *most* common platforms, no...
python, official-docs, cpython, P0
Local_Trusted_Corpus
257f5e2d-807f-4eed-88c1-7643db1b63db
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,390
supabase-export-v2
3a4601396f39a39d
any argument which obeys the rules for sequence objects, including any new classes you might define yourself. Similar methods exist for bytes and bytearray objects. How fast are exceptions? ------------------------
trusted_official_docs
CPython Docs
any argument which obeys the rules for sequence objects, including any new classes you might define yourself. Similar methods exist for bytes and bytearray objects. How fast are exceptions? ------------------------
any argument which obeys the rules for sequence objects, including any new classes you might define yourself. Similar methods exist for bytes and bytearray objects. How fast are exceptions? ------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
289f305e-ca6c-4a61-9306-74a10bb118ce
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,448
supabase-export-v2
59451744a9e26099
modified a list by accident. It also invalidates an important invariant of dictionaries: every value in ``d.keys()`` is usable as a key of the dictionary. - Mark lists as read-only once they are used as a dictionary key. The problem is that it's not just the top-level object that could change its value; you could use...
trusted_official_docs
CPython Docs
modified a list by accident. It also invalidates an important invariant of dictionaries: every value in ``d.keys()`` is usable as a key of the dictionary. - Mark lists as read-only once they are used as a dictionary key. The problem is that it's not just the top-level object that could change its value; you could use...
modified a list by accident. It also invalidates an important invariant of dictionaries: every value in ``d.keys()`` is usable as a key of the dictionary. - Mark lists as read-only once they are used as a dictionary key. The problem is that it's not just the top-level object that could change its value; you could use...
python, official-docs, cpython, P0
Local_Trusted_Corpus
29f2449c-1031-42d0-8421-6488b17e8a9b
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,452
supabase-export-v2
bf367c066a3dcd2f
def __eq__(self, other): return self.the_list == other.the_list def __hash__(self): l = self.the_list result = 98767 - len(l)*555 for i, el in enumerate(l): try: result = result + (hash(el) % 9999999) * 1001 + i except Exception: result = (result % 7777777) + i * 333 return result
trusted_official_docs
CPython Docs
def __eq__(self, other): return self.the_list == other.the_list def __hash__(self): l = self.the_list result = 98767 - len(l)*555 for i, el in enumerate(l): try: result = result + (hash(el) % 9999999) * 1001 + i except Exception: result = (result % 7777777) + i * 333 return result
def __eq__(self, other): return self.the_list == other.the_list def __hash__(self): l = self.the_list result = 98767 - len(l)*555 for i, el in enumerate(l): try: result = result + (hash(el) % 9999999) * 1001 + i except Exception: result = (result % 7777777) + i * 333 return result
python, official-docs, cpython, P0
Local_Trusted_Corpus
2ba2f4e9-04b5-4ef5-b4a1-977d20b41b07
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,398
supabase-export-v2
ee299def0641b2a5
match literal values, or constants within a namespace, with a ``match ... case`` statement. An older alternative is a sequence of ``if... elif... elif... else``. For cases where you need to choose from a very large number of possibilities, you can create a dictionary mapping case values to functions to call. For exampl...
trusted_official_docs
CPython Docs
match literal values, or constants within a namespace, with a ``match ... case`` statement. An older alternative is a sequence of ``if... elif... elif... else``. For cases where you need to choose from a very large number of possibilities, you can create a dictionary mapping case values to functions to call. For exampl...
match literal values, or constants within a namespace, with a ``match ... case`` statement. An older alternative is a sequence of ``if... elif... elif... else``. For cases where you need to choose from a very large number of possibilities, you can create a dictionary mapping case values to functions to call. For exampl...
python, official-docs, cpython, P0
Local_Trusted_Corpus
2df79609-f25c-4490-a4dd-d3557aaec28e
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,454
supabase-export-v2
ea546610a0efb7bf
the hash computation is complicated by the possibility that some members of the list may be unhashable and also by the possibility of arithmetic overflow. Furthermore it must always be the case that if ``o1 == o2`` (ie ``o1.__eq__(o2) is True``) then ``hash(o1) == hash(o2)`` (ie, ``o1.__hash__() == o2.__hash__()``), re...
trusted_official_docs
CPython Docs
the hash computation is complicated by the possibility that some members of the list may be unhashable and also by the possibility of arithmetic overflow. Furthermore it must always be the case that if ``o1 == o2`` (ie ``o1.__eq__(o2) is True``) then ``hash(o1) == hash(o2)`` (ie, ``o1.__hash__() == o2.__hash__()``), re...
the hash computation is complicated by the possibility that some members of the list may be unhashable and also by the possibility of arithmetic overflow. Furthermore it must always be the case that if ``o1 == o2`` (ie ``o1.__eq__(o2) is True``) then ``hash(o1) == hash(o2)`` (ie, ``o1.__hash__() == o2.__hash__()``), re...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3085e6a9-f830-4d32-a2ab-eeb45a62d880
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,377
supabase-export-v2
4f4a46be82074772
As Guido said: (a) For some operations, prefix notation just reads better than postfix -- prefix (and infix!) operations have a long tradition in mathematics which likes notations where the visuals help the mathematician thinking about a problem. Compare the easy with which we rewrite a formula like x*(a+b) into x*...
trusted_official_docs
CPython Docs
As Guido said: (a) For some operations, prefix notation just reads better than postfix -- prefix (and infix!) operations have a long tradition in mathematics which likes notations where the visuals help the mathematician thinking about a problem. Compare the easy with which we rewrite a formula like x*(a+b) into x*...
As Guido said: (a) For some operations, prefix notation just reads better than postfix -- prefix (and infix!) operations have a long tradition in mathematics which likes notations where the visuals help the mathematician thinking about a problem. Compare the easy with which we rewrite a formula like x*(a+b) into x*...
python, official-docs, cpython, P0
Local_Trusted_Corpus
30d7b5ec-8764-4685-81a8-a61ce5cc4fbb
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,406
supabase-export-v2
6ebf8e2c306564a5
Imitating switch with fallthrough, as with C's switch-case-default, is possible, much harder, and less needed. Can't you emulate threads in the interpreter instead of relying on an OS-specific thread implementation? --------------------------------------------------------------------------------------------------------
trusted_official_docs
CPython Docs
Imitating switch with fallthrough, as with C's switch-case-default, is possible, much harder, and less needed. Can't you emulate threads in the interpreter instead of relying on an OS-specific thread implementation? --------------------------------------------------------------------------------------------------------
Imitating switch with fallthrough, as with C's switch-case-default, is possible, much harder, and less needed. Can't you emulate threads in the interpreter instead of relying on an OS-specific thread implementation? --------------------------------------------------------------------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
3247cf69-cbf7-4bab-a9a0-8f43bc17ec00
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,506
supabase-export-v2
b8f9064380af089a
There are several reasons to allow this. When you have a literal value for a list, tuple, or dictionary spread across multiple lines, it's easier to add more elements because you don't have to remember to add a comma to the previous line. The lines can also be reordered without creating a syntax error.
trusted_official_docs
CPython Docs
There are several reasons to allow this. When you have a literal value for a list, tuple, or dictionary spread across multiple lines, it's easier to add more elements because you don't have to remember to add a comma to the previous line. The lines can also be reordered without creating a syntax error.
There are several reasons to allow this. When you have a literal value for a list, tuple, or dictionary spread across multiple lines, it's easier to add more elements because you don't have to remember to add a comma to the previous line. The lines can also be reordered without creating a syntax error.
python, official-docs, cpython, P0
Local_Trusted_Corpus
335ccfbb-8afc-46c4-b629-e275a8705a07
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,465
supabase-export-v2
fea51bb383e29510
:mod:`doctest` and :mod:`unittest` modules or third-party test frameworks can be used to construct exhaustive test suites that exercise every line of code in a module. An appropriate testing discipline can help build large complex applications in Python as well as having interface specifications would. In fact, it can ...
trusted_official_docs
CPython Docs
:mod:`doctest` and :mod:`unittest` modules or third-party test frameworks can be used to construct exhaustive test suites that exercise every line of code in a module. An appropriate testing discipline can help build large complex applications in Python as well as having interface specifications would. In fact, it can ...
:mod:`doctest` and :mod:`unittest` modules or third-party test frameworks can be used to construct exhaustive test suites that exercise every line of code in a module. An appropriate testing discipline can help build large complex applications in Python as well as having interface specifications would. In fact, it can ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
33a75368-5119-4581-a14d-f8a6e45fb4d3
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,432
supabase-export-v2
207016ffe192a915
why tuples, but not lists, can be used as keys. Note, however, that a tuple is only hashable if all of its elements are hashable. How are lists implemented in CPython? -------------------------------------
trusted_official_docs
CPython Docs
why tuples, but not lists, can be used as keys. Note, however, that a tuple is only hashable if all of its elements are hashable. How are lists implemented in CPython? -------------------------------------
why tuples, but not lists, can be used as keys. Note, however, that a tuple is only hashable if all of its elements are hashable. How are lists implemented in CPython? -------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
3787bd26-e6be-4883-8d2e-68a00e7ac01f
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,445
supabase-export-v2
d6b7388e40700bcf
mydict = {[1, 2]: '12'} print(mydict[[1, 2]]) would raise a :exc:`KeyError` exception because the id of the ``[1, 2]`` used in the second line differs from that in the first line. In other words, dictionary keys should be compared using ``==``, not using :keyword:`is`.
trusted_official_docs
CPython Docs
mydict = {[1, 2]: '12'} print(mydict[[1, 2]]) would raise a :exc:`KeyError` exception because the id of the ``[1, 2]`` used in the second line differs from that in the first line. In other words, dictionary keys should be compared using ``==``, not using :keyword:`is`.
mydict = {[1, 2]: '12'} print(mydict[[1, 2]]) would raise a :exc:`KeyError` exception because the id of the ``[1, 2]`` used in the second line differs from that in the first line. In other words, dictionary keys should be compared using ``==``, not using :keyword:`is`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
37fcb459-f0b6-4fa8-9c0c-00d31d3eb123
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,466
supabase-export-v2
79867c487685e6c3
an interface specification cannot test that your :meth:`list.append` implementation will actually do this correctly, but it's trivial to check this property in a test suite. Writing test suites is very helpful, and you might want to design your code to make it easily tested. One increasingly popular technique, test-dri...
trusted_official_docs
CPython Docs
an interface specification cannot test that your :meth:`list.append` implementation will actually do this correctly, but it's trivial to check this property in a test suite. Writing test suites is very helpful, and you might want to design your code to make it easily tested. One increasingly popular technique, test-dri...
an interface specification cannot test that your :meth:`list.append` implementation will actually do this correctly, but it's trivial to check this property in a test suite. Writing test suites is very helpful, and you might want to design your code to make it easily tested. One increasingly popular technique, test-dri...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3a20dbe4-961d-435a-8db2-9b0ed1b70caa
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,404
supabase-export-v2
8a657fb87aa13e57
def dispatch(self, value): method_name = 'visit_' + str(value) method = getattr(self, method_name) method() It's suggested that you use a prefix for the method names, such as ``visit_`` in this example. Without such a prefix, if values are coming from an untrusted source, an attacker would be able to call any method on...
trusted_official_docs
CPython Docs
def dispatch(self, value): method_name = 'visit_' + str(value) method = getattr(self, method_name) method() It's suggested that you use a prefix for the method names, such as ``visit_`` in this example. Without such a prefix, if values are coming from an untrusted source, an attacker would be able to call any method on...
def dispatch(self, value): method_name = 'visit_' + str(value) method = getattr(self, method_name) method() It's suggested that you use a prefix for the method names, such as ``visit_`` in this example. Without such a prefix, if values are coming from an untrusted source, an attacker would be able to call any method on...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3d14ebbe-7b77-4876-ab35-514fd5362229
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,505
supabase-export-v2
ca5b4a33387ccbff
[1, 2, 3,] ('a', 'b', 'c',) d = { "A": [1, 5], "B": [6, 7], # last trailing comma is optional but good style } There are several reasons to allow this.
trusted_official_docs
CPython Docs
[1, 2, 3,] ('a', 'b', 'c',) d = { "A": [1, 5], "B": [6, 7], # last trailing comma is optional but good style } There are several reasons to allow this.
[1, 2, 3,] ('a', 'b', 'c',) d = { "A": [1, 5], "B": [6, 7], # last trailing comma is optional but good style } There are several reasons to allow this.
python, official-docs, cpython, P0
Local_Trusted_Corpus
4198fbf0-cf05-45a1-b0a4-642c7e163484
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,416
supabase-export-v2
c15e4f9ae76bfb15
inaccessible cycles and deletes the objects involved. The :mod:`gc` module provides functions to perform a garbage collection, obtain debugging statistics, and tune the collector's parameters. Other implementations (such as `Jython <https://www.jython.org>`_ or `PyPy <https://pypy.org>`_), however, can rely on a differ...
trusted_official_docs
CPython Docs
inaccessible cycles and deletes the objects involved. The :mod:`gc` module provides functions to perform a garbage collection, obtain debugging statistics, and tune the collector's parameters. Other implementations (such as `Jython <https://www.jython.org>`_ or `PyPy <https://pypy.org>`_), however, can rely on a differ...
inaccessible cycles and deletes the objects involved. The :mod:`gc` module provides functions to perform a garbage collection, obtain debugging statistics, and tune the collector's parameters. Other implementations (such as `Jython <https://www.jython.org>`_ or `PyPy <https://pypy.org>`_), however, can rely on a differ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
41aa0663-3ed9-41af-b1a5-d8cd7560ee70
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,396
supabase-export-v2
0d7d7daacc5d1312
case, you could also use ``value = dict.setdefault(key, getvalue(key))``, but only if the ``getvalue()`` call is cheap enough because it is evaluated in all cases. Why isn't there a switch or case statement in Python? -----------------------------------------------------
trusted_official_docs
CPython Docs
case, you could also use ``value = dict.setdefault(key, getvalue(key))``, but only if the ``getvalue()`` call is cheap enough because it is evaluated in all cases. Why isn't there a switch or case statement in Python? -----------------------------------------------------
case, you could also use ``value = dict.setdefault(key, getvalue(key))``, but only if the ``getvalue()`` call is cheap enough because it is evaluated in all cases. Why isn't there a switch or case statement in Python? -----------------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
4717bf44-4529-44f6-961f-606920ddddca
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,397
supabase-export-v2
2ac11a16abac727e
Why isn't there a switch or case statement in Python? ----------------------------------------------------- In general, structured switch statements execute one block of code when an expression has a particular value or set of values. Since Python 3.10 one can easily match literal values, or constants within a namespac...
trusted_official_docs
CPython Docs
Why isn't there a switch or case statement in Python? ----------------------------------------------------- In general, structured switch statements execute one block of code when an expression has a particular value or set of values. Since Python 3.10 one can easily match literal values, or constants within a namespac...
Why isn't there a switch or case statement in Python? ----------------------------------------------------- In general, structured switch statements execute one block of code when an expression has a particular value or set of values. Since Python 3.10 one can easily match literal values, or constants within a namespac...
python, official-docs, cpython, P0
Local_Trusted_Corpus
488624fc-1620-48a1-9c61-bd64b7e6c672
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,378
supabase-export-v2
b201ff5e32750332
with which we rewrite a formula like x*(a+b) into x*a + x*b to the clumsiness of doing the same thing using a raw OO notation. (b) When I read code that says len(x) I *know* that it is asking for the length of something. This tells me two things: the result is an integer, and the argument is some kind of container. T...
trusted_official_docs
CPython Docs
with which we rewrite a formula like x*(a+b) into x*a + x*b to the clumsiness of doing the same thing using a raw OO notation. (b) When I read code that says len(x) I *know* that it is asking for the length of something. This tells me two things: the result is an integer, and the argument is some kind of container. T...
with which we rewrite a formula like x*(a+b) into x*a + x*b to the clumsiness of doing the same thing using a raw OO notation. (b) When I read code that says len(x) I *know* that it is asking for the length of something. This tells me two things: the result is an integer, and the argument is some kind of container. T...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4b6728cb-0576-45a9-b8d9-616103919c94
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,426
supabase-export-v2
8ff827316beb6df4
Why isn't all memory freed when CPython exits? ---------------------------------------------- Objects referenced from the global namespaces of Python modules are not always deallocated when Python exits. This may happen if there are circular references. There are also certain bits of memory that are allocated by the C ...
trusted_official_docs
CPython Docs
Why isn't all memory freed when CPython exits? ---------------------------------------------- Objects referenced from the global namespaces of Python modules are not always deallocated when Python exits. This may happen if there are circular references. There are also certain bits of memory that are allocated by the C ...
Why isn't all memory freed when CPython exits? ---------------------------------------------- Objects referenced from the global namespaces of Python modules are not always deallocated when Python exits. This may happen if there are circular references. There are also certain bits of memory that are allocated by the C ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4d05c9b3-49d5-4a4d-bf4c-0530169bbee2
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,510
supabase-export-v2
5d9ebf17cf3a3e42
list looks like it has four elements, but it actually contains three: "fee", "fiefoo" and "fum". Always adding the comma avoids this source of error. Allowing the trailing comma may also make programmatic code generation easier.
trusted_official_docs
CPython Docs
list looks like it has four elements, but it actually contains three: "fee", "fiefoo" and "fum". Always adding the comma avoids this source of error. Allowing the trailing comma may also make programmatic code generation easier.
list looks like it has four elements, but it actually contains three: "fee", "fiefoo" and "fum". Always adding the comma avoids this source of error. Allowing the trailing comma may also make programmatic code generation easier.
python, official-docs, cpython, P0
Local_Trusted_Corpus
4e498978-bef7-42e1-a42c-1c74a396a834
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,496
supabase-export-v2
42fae89f01ef159b
Why don't generators support the with statement? ------------------------------------------------ For technical reasons, a generator used directly as a context manager would not work correctly. When, as is most common, a generator is used as an iterator run to completion, no closing is needed. When it is, wrap it as :f...
trusted_official_docs
CPython Docs
Why don't generators support the with statement? ------------------------------------------------ For technical reasons, a generator used directly as a context manager would not work correctly. When, as is most common, a generator is used as an iterator run to completion, no closing is needed. When it is, wrap it as :f...
Why don't generators support the with statement? ------------------------------------------------ For technical reasons, a generator used directly as a context manager would not work correctly. When, as is most common, a generator is used as an iterator run to completion, no closing is needed. When it is, wrap it as :f...
python, official-docs, cpython, P0
Local_Trusted_Corpus
5228a2ba-a202-4046-a55c-0cae32ea52fc
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,488
supabase-export-v2
b85b551eb34f8e0e
def foo(a): with a: print(x) The snippet assumes that ``a`` must have a member attribute called ``x``. However, there is nothing in Python that tells the interpreter this. What should happen if ``a`` is, let us say, an integer? If there is a global variable named ``x``, will it be used inside the :keyword:`with` block?...
trusted_official_docs
CPython Docs
def foo(a): with a: print(x) The snippet assumes that ``a`` must have a member attribute called ``x``. However, there is nothing in Python that tells the interpreter this. What should happen if ``a`` is, let us say, an integer? If there is a global variable named ``x``, will it be used inside the :keyword:`with` block?...
def foo(a): with a: print(x) The snippet assumes that ``a`` must have a member attribute called ``x``. However, there is nothing in Python that tells the interpreter this. What should happen if ``a`` is, let us say, an integer? If there is a global variable named ``x``, will it be used inside the :keyword:`with` block?...
python, official-docs, cpython, P0
Local_Trusted_Corpus
524d55f9-4b21-4d58-9dac-c62b7a5187fb
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,361
supabase-export-v2
0d36f783ab1211c3
at creation time, and the storage requirements are fixed and unchanging. This is also one of the reasons for the distinction between tuples and lists. Another advantage is that strings in Python are considered as "elemental" as numbers. No amount of activity will change the value 8 to anything else, and in Python, no a...
trusted_official_docs
CPython Docs
at creation time, and the storage requirements are fixed and unchanging. This is also one of the reasons for the distinction between tuples and lists. Another advantage is that strings in Python are considered as "elemental" as numbers. No amount of activity will change the value 8 to anything else, and in Python, no a...
at creation time, and the storage requirements are fixed and unchanging. This is also one of the reasons for the distinction between tuples and lists. Another advantage is that strings in Python are considered as "elemental" as numbers. No amount of activity will change the value 8 to anything else, and in Python, no a...
python, official-docs, cpython, P0
Local_Trusted_Corpus
57a94249-de37-4392-830b-4d07febee9dd
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,453
supabase-export-v2
05499af02b9b297d
try: result = result + (hash(el) % 9999999) * 1001 + i except Exception: result = (result % 7777777) + i * 333 return result Note that the hash computation is complicated by the possibility that some members of the list may be unhashable and also by the possibility of arithmetic overflow.
trusted_official_docs
CPython Docs
try: result = result + (hash(el) % 9999999) * 1001 + i except Exception: result = (result % 7777777) + i * 333 return result Note that the hash computation is complicated by the possibility that some members of the list may be unhashable and also by the possibility of arithmetic overflow.
try: result = result + (hash(el) % 9999999) * 1001 + i except Exception: result = (result % 7777777) + i * 333 return result Note that the hash computation is complicated by the possibility that some members of the list may be unhashable and also by the possibility of arithmetic overflow.
python, official-docs, cpython, P0
Local_Trusted_Corpus
57b4fb2c-d926-4c28-bf91-8ce6e78bc51f
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,427
supabase-export-v2
eb8c51d3547cf265
tool like Purify will complain about these). Python is, however, aggressive about cleaning up memory on exit and does try to destroy every single object. If you want to force Python to delete certain things on deallocation use the :mod:`atexit` module to run a function that will force those deletions.
trusted_official_docs
CPython Docs
tool like Purify will complain about these). Python is, however, aggressive about cleaning up memory on exit and does try to destroy every single object. If you want to force Python to delete certain things on deallocation use the :mod:`atexit` module to run a function that will force those deletions.
tool like Purify will complain about these). Python is, however, aggressive about cleaning up memory on exit and does try to destroy every single object. If you want to force Python to delete certain things on deallocation use the :mod:`atexit` module to run a function that will force those deletions.
python, official-docs, cpython, P0
Local_Trusted_Corpus
59f68b4c-da6e-4939-95f7-edb54c1e7e8e
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,360
supabase-export-v2
51ee096a276bce4d
There are several advantages. One is performance: knowing that a string is immutable means we can allocate space for it at creation time, and the storage requirements are fixed and unchanging. This is also one of the reasons for the distinction between tuples and lists.
trusted_official_docs
CPython Docs
There are several advantages. One is performance: knowing that a string is immutable means we can allocate space for it at creation time, and the storage requirements are fixed and unchanging. This is also one of the reasons for the distinction between tuples and lists.
There are several advantages. One is performance: knowing that a string is immutable means we can allocate space for it at creation time, and the storage requirements are fixed and unchanging. This is also one of the reasons for the distinction between tuples and lists.
python, official-docs, cpython, P0
Local_Trusted_Corpus
5a50af80-6e0b-4e9e-a190-4c92c610bde4
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,497
supabase-export-v2
bd2359094c9d4551
generator is used as an iterator run to completion, no closing is needed. When it is, wrap it as :func:`contextlib.closing(generator) <contextlib.closing>` in the :keyword:`with` statement. Why are colons required for the if/while/def/class statements? --------------------------------------------------------------
trusted_official_docs
CPython Docs
generator is used as an iterator run to completion, no closing is needed. When it is, wrap it as :func:`contextlib.closing(generator) <contextlib.closing>` in the :keyword:`with` statement. Why are colons required for the if/while/def/class statements? --------------------------------------------------------------
generator is used as an iterator run to completion, no closing is needed. When it is, wrap it as :func:`contextlib.closing(generator) <contextlib.closing>` in the :keyword:`with` statement. Why are colons required for the if/while/def/class statements? --------------------------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
5c4f86d2-846d-4df3-bc5c-cbb1a93403ad
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,343
supabase-export-v2
542e75adf83233ce
the lack of begin/end brackets -- the lack of declarations and the high-level data types are also responsible -- but the indentation-based syntax certainly helps. Why am I getting strange results with simple arithmetic operations? -------------------------------------------------------------------
trusted_official_docs
CPython Docs
the lack of begin/end brackets -- the lack of declarations and the high-level data types are also responsible -- but the indentation-based syntax certainly helps. Why am I getting strange results with simple arithmetic operations? -------------------------------------------------------------------
the lack of begin/end brackets -- the lack of declarations and the high-level data types are also responsible -- but the indentation-based syntax certainly helps. Why am I getting strange results with simple arithmetic operations? -------------------------------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
5dd2a053-b595-4a9d-acd2-c7b03581c6c7
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,438
supabase-export-v2
db229935e3e885be
hash tables. Compared to B-trees, this gives better performance for lookup (the most common operation by far) under most circumstances, and the implementation is simpler. Dictionaries work by computing a hash code for each key stored in the dictionary using the :func:`hash` built-in function. The hash code varies widel...
trusted_official_docs
CPython Docs
hash tables. Compared to B-trees, this gives better performance for lookup (the most common operation by far) under most circumstances, and the implementation is simpler. Dictionaries work by computing a hash code for each key stored in the dictionary using the :func:`hash` built-in function. The hash code varies widel...
hash tables. Compared to B-trees, this gives better performance for lookup (the most common operation by far) under most circumstances, and the implementation is simpler. Dictionaries work by computing a hash code for each key stored in the dictionary using the :func:`hash` built-in function. The hash code varies widel...
python, official-docs, cpython, P0
Local_Trusted_Corpus
62ed82f3-21c0-41e6-8bed-03959168f385
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,424
supabase-export-v2
667c79d646fa4d25
not for all of them, and although it is mostly transparent, it isn't completely transparent; patches are required to get Python to work with it.) Traditional GC also becomes a problem when Python is embedded into other applications. While in a standalone Python it's fine to replace the standard ``malloc()`` and ``free(...
trusted_official_docs
CPython Docs
not for all of them, and although it is mostly transparent, it isn't completely transparent; patches are required to get Python to work with it.) Traditional GC also becomes a problem when Python is embedded into other applications. While in a standalone Python it's fine to replace the standard ``malloc()`` and ``free(...
not for all of them, and although it is mostly transparent, it isn't completely transparent; patches are required to get Python to work with it.) Traditional GC also becomes a problem when Python is embedded into other applications. While in a standalone Python it's fine to replace the standard ``malloc()`` and ``free(...
python, official-docs, cpython, P0
Local_Trusted_Corpus
63432b9b-b85f-4167-8d05-f4b9cb9aeec2
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,469
supabase-export-v2
11d5ac9a89496516
to branch (in Python, with :keyword:`if` statements and :keyword:`or`, :keyword:`and`, and :keyword:`if`/:keyword:`else` expressions) and loop (with :keyword:`while` and :keyword:`for` statements, possibly containing :keyword:`continue` and :keyword:`break`). One can also use exceptions to provide a "structured goto" t...
trusted_official_docs
CPython Docs
to branch (in Python, with :keyword:`if` statements and :keyword:`or`, :keyword:`and`, and :keyword:`if`/:keyword:`else` expressions) and loop (with :keyword:`while` and :keyword:`for` statements, possibly containing :keyword:`continue` and :keyword:`break`). One can also use exceptions to provide a "structured goto" t...
to branch (in Python, with :keyword:`if` statements and :keyword:`or`, :keyword:`and`, and :keyword:`if`/:keyword:`else` expressions) and loop (with :keyword:`while` and :keyword:`for` statements, possibly containing :keyword:`continue` and :keyword:`break`). One can also use exceptions to provide a "structured goto" t...
python, official-docs, cpython, P0
Local_Trusted_Corpus
64b3fc71-b8e5-449e-b87c-cebf7465a552
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,342
supabase-export-v2
2a65c28b15387285
and writing code using a particular style, it is normal to feel somewhat uneasy when reading (or being required to write) in a different one. Many coding styles place begin/end brackets on a line by themselves. This makes programs considerably longer and wastes valuable screen space, making it harder to get a good over...
trusted_official_docs
CPython Docs
and writing code using a particular style, it is normal to feel somewhat uneasy when reading (or being required to write) in a different one. Many coding styles place begin/end brackets on a line by themselves. This makes programs considerably longer and wastes valuable screen space, making it harder to get a good over...
and writing code using a particular style, it is normal to feel somewhat uneasy when reading (or being required to write) in a different one. Many coding styles place begin/end brackets on a line by themselves. This makes programs considerably longer and wastes valuable screen space, making it harder to get a good over...
python, official-docs, cpython, P0
Local_Trusted_Corpus
68bf5081-4db5-4d37-8c00-037d59cd5de2
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,501
supabase-export-v2
12e041ae914b25b5
one is slightly easier to read. Notice further how a colon sets off the example in this FAQ answer; it's a standard usage in English. Another minor reason is that the colon makes it easier for editors with syntax highlighting; they can look for colons to decide when indentation needs to be increased instead of having t...
trusted_official_docs
CPython Docs
one is slightly easier to read. Notice further how a colon sets off the example in this FAQ answer; it's a standard usage in English. Another minor reason is that the colon makes it easier for editors with syntax highlighting; they can look for colons to decide when indentation needs to be increased instead of having t...
one is slightly easier to read. Notice further how a colon sets off the example in this FAQ answer; it's a standard usage in English. Another minor reason is that the colon makes it easier for editors with syntax highlighting; they can look for colons to decide when indentation needs to be increased instead of having t...
python, official-docs, cpython, P0
Local_Trusted_Corpus
6c69d851-0886-4430-afa6-2a1390557d4b
CPython Docs
file://datasets/cpython/Doc/faq/design.rst
unknown
411c1525-6760-4db2-85f2-d72432bcf885
2,442
supabase-export-v2
67d9bb73d604cec0
the function ``tuple(L)`` creates a tuple with the same entries as the list ``L``. Tuples are immutable and can therefore be used as dictionary keys. Some unacceptable solutions that have been proposed:
trusted_official_docs
CPython Docs
the function ``tuple(L)`` creates a tuple with the same entries as the list ``L``. Tuples are immutable and can therefore be used as dictionary keys. Some unacceptable solutions that have been proposed:
the function ``tuple(L)`` creates a tuple with the same entries as the list ``L``. Tuples are immutable and can therefore be used as dictionary keys. Some unacceptable solutions that have been proposed:
python, official-docs, cpython, P0
Local_Trusted_Corpus