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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ea93548f-944b-49b1-8a56-caa78c586991 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,399 | supabase-export-v2 | bf66cb878a31d936 | match point: case (0, 0): print("Origin") case (0, y): print(f"Y={y}") case (x, 0): print(f"X={x}") case (x, y): print(f"X={x}, Y={y}") case _: raise ValueError("Not a point")
Study that one carefully! The first pattern has two literals, and can
be thought of as an extension of the literal pattern shown above. But
the ... | trusted_official_docs | CPython Docs | match point: case (0, 0): print("Origin") case (0, y): print(f"Y={y}") case (x, 0): print(f"X={x}") case (x, y): print(f"X={x}, Y={y}") case _: raise ValueError("Not a point")
Study that one carefully! The first pattern has two literals, and can
be thought of as an extension of the literal pattern shown above. But
the ... | match point: case (0, 0): print("Origin") case (0, y): print(f"Y={y}") case (x, 0): print(f"X={x}") case (x, y): print(f"X={x}, Y={y}") case _: raise ValueError("Not a point")
Study that one carefully! The first pattern has two literals, and can
be thought of as an extension of the literal pattern shown above. But
the ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eb9e23b5-bd50-4be0-bf3a-b109ac26a436 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,561 | supabase-export-v2 | 302419b90d77fe62 | a very readable and eye-pleasing coding style. Every Python developer should read it at some point; here are the most important points extracted for you:
* Use 4-space indentation, and no tabs. | trusted_official_docs | CPython Docs | a very readable and eye-pleasing coding style. Every Python developer should read it at some point; here are the most important points extracted for you:
* Use 4-space indentation, and no tabs. | a very readable and eye-pleasing coding style. Every Python developer should read it at some point; here are the most important points extracted for you:
* Use 4-space indentation, and no tabs. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ebeae88b-2541-4e25-abdb-f6b1e4c5b3c9 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,343 | supabase-export-v2 | c103fa39852e500b | be tricky to get right. Instead, it is usually more straight-forward to loop over a copy of the collection or to create a new collection::
# Create a sample collection
users = {'Hans': 'active', 'Éléonore': 'inactive', '景太郎': 'active'} | trusted_official_docs | CPython Docs | be tricky to get right. Instead, it is usually more straight-forward to loop over a copy of the collection or to create a new collection::
# Create a sample collection
users = {'Hans': 'active', 'Éléonore': 'inactive', '景太郎': 'active'} | be tricky to get right. Instead, it is usually more straight-forward to loop over a copy of the collection or to create a new collection::
# Create a sample collection
users = {'Hans': 'active', 'Éléonore': 'inactive', '景太郎': 'active'} | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f1ce6e60-a252-4bd9-b83c-2f6927a8ca9b | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,544 | supabase-export-v2 | 397008ac62a8596e | Here are some conventions about the content and formatting of documentation strings.
The first line should always be a short, concise summary of the object's
purpose. For brevity, it should not explicitly state the object's name or type,
since these are available by other means (except if the name happens to be a
verb ... | trusted_official_docs | CPython Docs | Here are some conventions about the content and formatting of documentation strings.
The first line should always be a short, concise summary of the object's
purpose. For brevity, it should not explicitly state the object's name or type,
since these are available by other means (except if the name happens to be a
verb ... | Here are some conventions about the content and formatting of documentation strings.
The first line should always be a short, concise summary of the object's
purpose. For brevity, it should not explicitly state the object's name or type,
since these are available by other means (except if the name happens to be a
verb ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f5f2f415-da3f-4f1f-85b3-dbe2955990dc | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,429 | supabase-export-v2 | 111ea0019a8999cd | .. index:: single: documentation strings single: docstrings single: strings, documentation
The keyword :keyword:`def` introduces a function *definition*. It must be
followed by the function name and the parenthesized list of formal parameters. The statements that form the body of the function start at the next line, an... | trusted_official_docs | CPython Docs | .. index:: single: documentation strings single: docstrings single: strings, documentation
The keyword :keyword:`def` introduces a function *definition*. It must be
followed by the function name and the parenthesized list of formal parameters. The statements that form the body of the function start at the next line, an... | .. index:: single: documentation strings single: docstrings single: strings, documentation
The keyword :keyword:`def` introduces a function *definition*. It must be
followed by the function name and the parenthesized list of formal parameters. The statements that form the body of the function start at the next line, an... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f801f2f5-5078-400c-9931-59861595b34e | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,420 | supabase-export-v2 | b58b152b0225e772 | - Patterns may use named constants. These must be dotted names to prevent them from being interpreted as capture variables::
from enum import Enum
class Color(Enum):
RED = 'red'
GREEN = 'green'
BLUE = 'blue' | trusted_official_docs | CPython Docs | - Patterns may use named constants. These must be dotted names to prevent them from being interpreted as capture variables::
from enum import Enum
class Color(Enum):
RED = 'red'
GREEN = 'green'
BLUE = 'blue' | - Patterns may use named constants. These must be dotted names to prevent them from being interpreted as capture variables::
from enum import Enum
class Color(Enum):
RED = 'red'
GREEN = 'green'
BLUE = 'blue' | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f90ab822-dcbf-425a-bdd4-682caa7fb194 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,548 | supabase-export-v2 | 411e3daa267fa42f | Here is an example of a multi-line docstring::
>>> def my_function():
... """Do nothing, but document it. ... ... No, really, it doesn't do anything:
... ... >>> my_function()
... >>>
... """
... pass
... >>> print(my_function.__doc__)
Do nothing, but document it. | trusted_official_docs | CPython Docs | Here is an example of a multi-line docstring::
>>> def my_function():
... """Do nothing, but document it. ... ... No, really, it doesn't do anything:
... ... >>> my_function()
... >>>
... """
... pass
... >>> print(my_function.__doc__)
Do nothing, but document it. | Here is an example of a multi-line docstring::
>>> def my_function():
... """Do nothing, but document it. ... ... No, really, it doesn't do anything:
... ... >>> my_function()
... >>>
... """
... pass
... >>> print(my_function.__doc__)
Do nothing, but document it. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fded2946-d5ab-4a75-a6a6-f738a761e065 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,379 | supabase-export-v2 | e72edf49045166bd | times. If the condition is ever true, a ``break`` will happen. If the condition is never true, the ``else`` clause outside the loop will execute.
When used with a loop, the ``else`` clause has more in common with the ``else``
clause of a :keyword:`try` statement than it does with that of ``if``
statements: a ``try`` st... | trusted_official_docs | CPython Docs | times. If the condition is ever true, a ``break`` will happen. If the condition is never true, the ``else`` clause outside the loop will execute.
When used with a loop, the ``else`` clause has more in common with the ``else``
clause of a :keyword:`try` statement than it does with that of ``if``
statements: a ``try`` st... | times. If the condition is ever true, a ``break`` will happen. If the condition is never true, the ``else`` clause outside the loop will execute.
When used with a loop, the ``else`` clause has more in common with the ``else``
clause of a :keyword:`try` statement than it does with that of ``if``
statements: a ``try`` st... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fe1ba8a5-aac2-46ef-981b-5953bc68e1e1 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,523 | supabase-export-v2 | 431db85ba407f08c | .. index:: single: * (asterisk); in function calls
Finally, the least frequently used option is to specify that a function can be
called with an arbitrary number of arguments. These arguments will be wrapped
up in a tuple (see :ref:`tut-tuples`). Before the variable number of arguments,
zero or more normal arguments ma... | trusted_official_docs | CPython Docs | .. index:: single: * (asterisk); in function calls
Finally, the least frequently used option is to specify that a function can be
called with an arbitrary number of arguments. These arguments will be wrapped
up in a tuple (see :ref:`tut-tuples`). Before the variable number of arguments,
zero or more normal arguments ma... | .. index:: single: * (asterisk); in function calls
Finally, the least frequently used option is to specify that a function can be
called with an arbitrary number of arguments. These arguments will be wrapped
up in a tuple (see :ref:`tut-tuples`). Before the variable number of arguments,
zero or more normal arguments ma... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fe7488a4-cd53-48b6-866d-a0ee09e00cd6 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,375 | supabase-export-v2 | 5c16300c3dad9ac7 | Of course, other ways of ending the loop early, such as a :keyword:`return` or a raised exception, will also skip execution of the :keyword:`else` clause.
This is exemplified in the following :keyword:`!for` loop,
which searches for prime numbers:: | trusted_official_docs | CPython Docs | Of course, other ways of ending the loop early, such as a :keyword:`return` or a raised exception, will also skip execution of the :keyword:`else` clause.
This is exemplified in the following :keyword:`!for` loop,
which searches for prime numbers:: | Of course, other ways of ending the loop early, such as a :keyword:`return` or a raised exception, will also skip execution of the :keyword:`else` clause.
This is exemplified in the following :keyword:`!for` loop,
which searches for prime numbers:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ff8431d4-28fc-4a8e-a169-9991e48eae65 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,508 | supabase-export-v2 | 7a9cad1d837f0c47 | combined_example(pos_only=1, standard=2, kwd_only=3) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: combined_example() got some positional-only arguments passed as keyword arguments: 'pos_only'
Finally, consider this function definition which has a potential collision between the posi... | trusted_official_docs | CPython Docs | combined_example(pos_only=1, standard=2, kwd_only=3) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: combined_example() got some positional-only arguments passed as keyword arguments: 'pos_only'
Finally, consider this function definition which has a potential collision between the posi... | combined_example(pos_only=1, standard=2, kwd_only=3) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: combined_example() got some positional-only arguments passed as keyword arguments: 'pos_only'
Finally, consider this function definition which has a potential collision between the posi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0df674da-f373-4929-a0df-7a99339a9ea2 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,582 | supabase-export-v2 | 7f239cf3ff924ca2 | Python version from which the command was run (as reported by the :option:`--version` option). For instance, executing the command with ``python3.12`` will install version 3.12.
To create a virtual environment, decide upon a directory where you want to
place it, and run the :mod:`venv` module as a script with the direc... | trusted_official_docs | CPython Docs | Python version from which the command was run (as reported by the :option:`--version` option). For instance, executing the command with ``python3.12`` will install version 3.12.
To create a virtual environment, decide upon a directory where you want to
place it, and run the :mod:`venv` module as a script with the direc... | Python version from which the command was run (as reported by the :option:`--version` option). For instance, executing the command with ``python3.12`` will install version 3.12.
To create a virtual environment, decide upon a directory where you want to
place it, and run the :mod:`venv` module as a script with the direc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
19afec96-a5fd-4ef0-80e6-4d2e1cb5ca22 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,611 | supabase-export-v2 | 8c5bb7fb1413e712 | .. code-block:: console
(tutorial-env) $ python -m pip show requests
---
Metadata-Version: 2.0
Name: requests
Version: 2.7.0
Summary: Python HTTP for Humans. Home-page: http://python-requests.org
Author: Kenneth Reitz
Author-email: me@kennethreitz.com
License: Apache 2.0
Location: /Users/akuchling/envs/tutoria... | trusted_official_docs | CPython Docs | .. code-block:: console
(tutorial-env) $ python -m pip show requests
---
Metadata-Version: 2.0
Name: requests
Version: 2.7.0
Summary: Python HTTP for Humans. Home-page: http://python-requests.org
Author: Kenneth Reitz
Author-email: me@kennethreitz.com
License: Apache 2.0
Location: /Users/akuchling/envs/tutoria... | .. code-block:: console
(tutorial-env) $ python -m pip show requests
---
Metadata-Version: 2.0
Name: requests
Version: 2.7.0
Summary: Python HTTP for Humans. Home-page: http://python-requests.org
Author: Kenneth Reitz
Author-email: me@kennethreitz.com
License: Apache 2.0
Location: /Users/akuchling/envs/tutoria... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1ab9fbe5-b96f-41b2-92e5-e9ac7e8b1066 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,608 | supabase-export-v2 | c636ef29e6f0e789 | python -m pip install --upgrade requests Collecting requests Installing collected packages: requests Found existing installation: requests 2.6.0 Uninstalling requests-2.6.0: Successfully uninstalled requests-2.6.0 Successfully installed requests-2.7.0
``python -m pip uninstall`` followed by one or more package names wi... | trusted_official_docs | CPython Docs | python -m pip install --upgrade requests Collecting requests Installing collected packages: requests Found existing installation: requests 2.6.0 Uninstalling requests-2.6.0: Successfully uninstalled requests-2.6.0 Successfully installed requests-2.7.0
``python -m pip uninstall`` followed by one or more package names wi... | python -m pip install --upgrade requests Collecting requests Installing collected packages: requests Found existing installation: requests 2.6.0 Uninstalling requests-2.6.0: Successfully uninstalled requests-2.6.0 Successfully installed requests-2.7.0
``python -m pip uninstall`` followed by one or more package names wi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
23f74486-f82d-411e-9bd6-d8f7657ab46c | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,607 | supabase-export-v2 | a0fc3df0440ca131 | .. code-block:: console
(tutorial-env) $ python -m pip install --upgrade requests
Collecting requests
Installing collected packages: requests
Found existing installation: requests 2.6.0
Uninstalling requests-2.6.0:
Successfully uninstalled requests-2.6.0
Successfully installed requests-2.7.0 | trusted_official_docs | CPython Docs | .. code-block:: console
(tutorial-env) $ python -m pip install --upgrade requests
Collecting requests
Installing collected packages: requests
Found existing installation: requests 2.6.0
Uninstalling requests-2.6.0:
Successfully uninstalled requests-2.6.0
Successfully installed requests-2.7.0 | .. code-block:: console
(tutorial-env) $ python -m pip install --upgrade requests
Collecting requests
Installing collected packages: requests
Found existing installation: requests 2.6.0
Uninstalling requests-2.6.0:
Successfully uninstalled requests-2.6.0
Successfully installed requests-2.7.0 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
49a799dc-5314-4ea8-96f5-14fc11473364 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,615 | supabase-export-v2 | 398518d1dd49ec06 | (tutorial-env) $ python -m pip list novas (3.1.1.3) numpy (1.9.2) pip (7.0.3) requests (2.7.0) setuptools (16.0)
``python -m pip freeze`` will produce a similar list of the installed packages,
but the output uses the format that ``python -m pip install`` expects. A common convention is to put this list in a ``requireme... | trusted_official_docs | CPython Docs | (tutorial-env) $ python -m pip list novas (3.1.1.3) numpy (1.9.2) pip (7.0.3) requests (2.7.0) setuptools (16.0)
``python -m pip freeze`` will produce a similar list of the installed packages,
but the output uses the format that ``python -m pip install`` expects. A common convention is to put this list in a ``requireme... | (tutorial-env) $ python -m pip list novas (3.1.1.3) numpy (1.9.2) pip (7.0.3) requests (2.7.0) setuptools (16.0)
``python -m pip freeze`` will produce a similar list of the installed packages,
but the output uses the format that ``python -m pip install`` expects. A common convention is to put this list in a ``requireme... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4eeb5c82-7fd7-4e8d-86c8-214ed6483cdc | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,584 | supabase-export-v2 | dcf38f50672efc73 | python -m venv tutorial-env
This will create the ``tutorial-env`` directory if it doesn't exist,
and also create directories inside it containing a copy of the Python
interpreter and various supporting files. | trusted_official_docs | CPython Docs | python -m venv tutorial-env
This will create the ``tutorial-env`` directory if it doesn't exist,
and also create directories inside it containing a copy of the Python
interpreter and various supporting files. | python -m venv tutorial-env
This will create the ``tutorial-env`` directory if it doesn't exist,
and also create directories inside it containing a copy of the Python
interpreter and various supporting files. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
52d32d94-33e2-45ab-bf99-3f5bbf5457fe | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,609 | supabase-export-v2 | 28acd31da8d9cc86 | ``python -m pip uninstall`` followed by one or more package names will remove the packages from the virtual environment.
``python -m pip show`` will display information about a particular package: | trusted_official_docs | CPython Docs | ``python -m pip uninstall`` followed by one or more package names will remove the packages from the virtual environment.
``python -m pip show`` will display information about a particular package: | ``python -m pip uninstall`` followed by one or more package names will remove the packages from the virtual environment.
``python -m pip show`` will display information about a particular package: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
561b6967-8e6c-4eb2-8555-5064700a65bd | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,621 | supabase-export-v2 | 8910969020df357d | ... Collecting requests==2.7.0 (from -r requirements.txt (line 3)) ... Installing collected packages: novas, numpy, requests Running setup.py install for novas Successfully installed novas-3.1.1.3 numpy-1.9.2 requests-2.7.0
``pip`` has many more options. Consult the :ref:`installing-index`
guide for complete documentat... | trusted_official_docs | CPython Docs | ... Collecting requests==2.7.0 (from -r requirements.txt (line 3)) ... Installing collected packages: novas, numpy, requests Running setup.py install for novas Successfully installed novas-3.1.1.3 numpy-1.9.2 requests-2.7.0
``pip`` has many more options. Consult the :ref:`installing-index`
guide for complete documentat... | ... Collecting requests==2.7.0 (from -r requirements.txt (line 3)) ... Installing collected packages: novas, numpy, requests Running setup.py install for novas Successfully installed novas-3.1.1.3 numpy-1.9.2 requests-2.7.0
``pip`` has many more options. Consult the :ref:`installing-index`
guide for complete documentat... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
64316ea7-67dc-4861-b59a-85cc61363366 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,622 | supabase-export-v2 | f28861122a34c23c | documentation for ``pip``. When you've written a package and want to make it available on the Python Package Index, consult the `Python packaging user guide`_.
.. _Python Packaging User Guide: https://packaging.python.org/en/latest/tutorials/packaging-projects/ | trusted_official_docs | CPython Docs | documentation for ``pip``. When you've written a package and want to make it available on the Python Package Index, consult the `Python packaging user guide`_.
.. _Python Packaging User Guide: https://packaging.python.org/en/latest/tutorials/packaging-projects/ | documentation for ``pip``. When you've written a package and want to make it available on the Python Package Index, consult the `Python packaging user guide`_.
.. _Python Packaging User Guide: https://packaging.python.org/en/latest/tutorials/packaging-projects/ | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
766e8059-bbd0-4f90-8478-da31f7689991 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,586 | supabase-export-v2 | 0bf2b008017e75ae | while giving it a name that explains why the directory exists. It also prevents clashing with ``.env`` environment variable definition files that some tooling supports.
Once you've created a virtual environment, you may activate it. | trusted_official_docs | CPython Docs | while giving it a name that explains why the directory exists. It also prevents clashing with ``.env`` environment variable definition files that some tooling supports.
Once you've created a virtual environment, you may activate it. | while giving it a name that explains why the directory exists. It also prevents clashing with ``.env`` environment variable definition files that some tooling supports.
Once you've created a virtual environment, you may activate it. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7a1dd244-a8a2-4a96-b1fc-be6f1b510de2 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,591 | supabase-export-v2 | 4edad36e25f293e4 | is written for the bash shell. If you use the :program:`csh` or :program:`fish` shells, there are alternate ``activate.csh`` and ``activate.fish`` scripts you should use instead.)
Activating the virtual environment will change your shell's prompt to show what
virtual environment you're using, and modify the environment... | trusted_official_docs | CPython Docs | is written for the bash shell. If you use the :program:`csh` or :program:`fish` shells, there are alternate ``activate.csh`` and ``activate.fish`` scripts you should use instead.)
Activating the virtual environment will change your shell's prompt to show what
virtual environment you're using, and modify the environment... | is written for the bash shell. If you use the :program:`csh` or :program:`fish` shells, there are alternate ``activate.csh`` and ``activate.fish`` scripts you should use instead.)
Activating the virtual environment will change your shell's prompt to show what
virtual environment you're using, and modify the environment... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8a9f1b54-b236-4bac-a970-bd1aa90cd5e0 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,579 | supabase-export-v2 | c763823b00b5409e | create a :term:`virtual environment`, a self-contained directory tree that contains a Python installation for a particular version of Python, plus a number of additional packages.
Different applications can then use different virtual environments. To resolve the earlier example of conflicting requirements,
application ... | trusted_official_docs | CPython Docs | create a :term:`virtual environment`, a self-contained directory tree that contains a Python installation for a particular version of Python, plus a number of additional packages.
Different applications can then use different virtual environments. To resolve the earlier example of conflicting requirements,
application ... | create a :term:`virtual environment`, a self-contained directory tree that contains a Python installation for a particular version of Python, plus a number of additional packages.
Different applications can then use different virtual environments. To resolve the earlier example of conflicting requirements,
application ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8c90e35f-679d-4cb8-bb96-6237236709e3 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,585 | supabase-export-v2 | cc3df3b178839387 | create the ``tutorial-env`` directory if it doesn't exist, and also create directories inside it containing a copy of the Python interpreter and various supporting files.
A common directory location for a virtual environment is ``.venv``. This name keeps the directory typically hidden in your shell and thus
out of the ... | trusted_official_docs | CPython Docs | create the ``tutorial-env`` directory if it doesn't exist, and also create directories inside it containing a copy of the Python interpreter and various supporting files.
A common directory location for a virtual environment is ``.venv``. This name keeps the directory typically hidden in your shell and thus
out of the ... | create the ``tutorial-env`` directory if it doesn't exist, and also create directories inside it containing a copy of the Python interpreter and various supporting files.
A common directory location for a virtual environment is ``.venv``. This name keeps the directory typically hidden in your shell and thus
out of the ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
91d88c82-e32b-432d-aadd-e6995b0928ea | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,581 | supabase-export-v2 | c01881a96ccb62f3 | Creating Virtual Environments =============================
The module used to create and manage virtual environments is called
:mod:`venv`. :mod:`venv` will install the Python version from which
the command was run (as reported by the :option:`--version` option). For instance, executing the command with ``python3.12``... | trusted_official_docs | CPython Docs | Creating Virtual Environments =============================
The module used to create and manage virtual environments is called
:mod:`venv`. :mod:`venv` will install the Python version from which
the command was run (as reported by the :option:`--version` option). For instance, executing the command with ``python3.12``... | Creating Virtual Environments =============================
The module used to create and manage virtual environments is called
:mod:`venv`. :mod:`venv` will install the Python version from which
the command was run (as reported by the :option:`--version` option). For instance, executing the command with ``python3.12``... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a014d0b3-ddc3-4fe4-ba64-ad3a13273905 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,577 | supabase-export-v2 | d03c4f323c9d1a2c | the application may require that a particular bug has been fixed or the application may be written using an obsolete version of the library's interface.
This means it may not be possible for one Python installation to meet
the requirements of every application. If application A needs version
1.0 of a particular module ... | trusted_official_docs | CPython Docs | the application may require that a particular bug has been fixed or the application may be written using an obsolete version of the library's interface.
This means it may not be possible for one Python installation to meet
the requirements of every application. If application A needs version
1.0 of a particular module ... | the application may require that a particular bug has been fixed or the application may be written using an obsolete version of the library's interface.
This means it may not be possible for one Python installation to meet
the requirements of every application. If application A needs version
1.0 of a particular module ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b2377896-7e52-4161-8dbe-b708320d09fc | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,602 | supabase-export-v2 | 99f88bcafb7c18e9 | (tutorial-env) $ python -m pip install novas Collecting novas Downloading novas-3.1.1.3.tar.gz (136kB) Installing collected packages: novas Running setup.py install for novas Successfully installed novas-3.1.1.3
You can also install a specific version of a package by giving the
package name followed by ``==`` and the v... | trusted_official_docs | CPython Docs | (tutorial-env) $ python -m pip install novas Collecting novas Downloading novas-3.1.1.3.tar.gz (136kB) Installing collected packages: novas Running setup.py install for novas Successfully installed novas-3.1.1.3
You can also install a specific version of a package by giving the
package name followed by ``==`` and the v... | (tutorial-env) $ python -m pip install novas Collecting novas Downloading novas-3.1.1.3.tar.gz (136kB) Installing collected packages: novas Running setup.py install for novas Successfully installed novas-3.1.1.3
You can also install a specific version of a package by giving the
package name followed by ``==`` and the v... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b5a7edd2-4cc7-4afa-9716-053677db6afe | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,578 | supabase-export-v2 | be22974aab1e6367 | application B needs version 2.0, then the requirements are in conflict and installing either version 1.0 or 2.0 will leave one application unable to run.
The solution for this problem is to create a :term:`virtual environment`, a
self-contained directory tree that contains a Python installation for a
particular version... | trusted_official_docs | CPython Docs | application B needs version 2.0, then the requirements are in conflict and installing either version 1.0 or 2.0 will leave one application unable to run.
The solution for this problem is to create a :term:`virtual environment`, a
self-contained directory tree that contains a Python installation for a
particular version... | application B needs version 2.0, then the requirements are in conflict and installing either version 1.0 or 2.0 will leave one application unable to run.
The solution for this problem is to create a :term:`virtual environment`, a
self-contained directory tree that contains a Python installation for a
particular version... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b9bd8ff6-a31c-4bb5-bdb1-b2414825f573 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,598 | supabase-export-v2 | a4b5548aa5b5ff0e | ``pip`` will install packages from the `Python Package Index <https://pypi.org>`_. You can browse the Python Package Index by going to it in your web browser.
``pip`` has a number of subcommands: "install", "uninstall",
"freeze", etc. (Consult the :ref:`installing-index` guide for
complete documentation for ``pip``.) | trusted_official_docs | CPython Docs | ``pip`` will install packages from the `Python Package Index <https://pypi.org>`_. You can browse the Python Package Index by going to it in your web browser.
``pip`` has a number of subcommands: "install", "uninstall",
"freeze", etc. (Consult the :ref:`installing-index` guide for
complete documentation for ``pip``.) | ``pip`` will install packages from the `Python Package Index <https://pypi.org>`_. You can browse the Python Package Index by going to it in your web browser.
``pip`` has a number of subcommands: "install", "uninstall",
"freeze", etc. (Consult the :ref:`installing-index` guide for
complete documentation for ``pip``.) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bd6a9e4b-063b-4150-ad07-a58549e93394 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,620 | supabase-export-v2 | ef1c4cf3b768feab | .. code-block:: console
(tutorial-env) $ python -m pip install -r requirements.txt
Collecting novas==3.1.1.3 (from -r requirements.txt (line 1))
... Collecting numpy==1.9.2 (from -r requirements.txt (line 2))
... Collecting requests==2.7.0 (from -r requirements.txt (line 3))
... Installing collected packages: novas... | trusted_official_docs | CPython Docs | .. code-block:: console
(tutorial-env) $ python -m pip install -r requirements.txt
Collecting novas==3.1.1.3 (from -r requirements.txt (line 1))
... Collecting numpy==1.9.2 (from -r requirements.txt (line 2))
... Collecting requests==2.7.0 (from -r requirements.txt (line 3))
... Installing collected packages: novas... | .. code-block:: console
(tutorial-env) $ python -m pip install -r requirements.txt
Collecting novas==3.1.1.3 (from -r requirements.txt (line 1))
... Collecting numpy==1.9.2 (from -r requirements.txt (line 2))
... Collecting requests==2.7.0 (from -r requirements.txt (line 3))
... Installing collected packages: novas... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d077dd7d-819f-430e-884b-e62121dcf81d | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,605 | supabase-export-v2 | a777a56539201e7b | (tutorial-env) $ python -m pip install requests==2.6.0 Collecting requests==2.6.0 Using cached requests-2.6.0-py2.py3-none-any.whl Installing collected packages: requests Successfully installed requests-2.6.0
If you re-run this command, ``pip`` will notice that the requested
version is already installed and do nothing.... | trusted_official_docs | CPython Docs | (tutorial-env) $ python -m pip install requests==2.6.0 Collecting requests==2.6.0 Using cached requests-2.6.0-py2.py3-none-any.whl Installing collected packages: requests Successfully installed requests-2.6.0
If you re-run this command, ``pip`` will notice that the requested
version is already installed and do nothing.... | (tutorial-env) $ python -m pip install requests==2.6.0 Collecting requests==2.6.0 Using cached requests-2.6.0-py2.py3-none-any.whl Installing collected packages: requests Successfully installed requests-2.6.0
If you re-run this command, ``pip`` will notice that the requested
version is already installed and do nothing.... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d1e4d90a-f411-4e66-b575-7c0ac100f812 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,594 | supabase-export-v2 | 8409ad9843726b41 | $ source ~/envs/tutorial-env/bin/activate (tutorial-env) $ python Python 3.5.1 (default, May 6 2016, 10:59:36) ... >>> import sys >>> sys.path ['', '/usr/local/lib/python35.zip', ..., '~/envs/tutorial-env/lib/python3.5/site-packages'] >>>
To deactivate a virtual environment, type:: | trusted_official_docs | CPython Docs | $ source ~/envs/tutorial-env/bin/activate (tutorial-env) $ python Python 3.5.1 (default, May 6 2016, 10:59:36) ... >>> import sys >>> sys.path ['', '/usr/local/lib/python35.zip', ..., '~/envs/tutorial-env/lib/python3.5/site-packages'] >>>
To deactivate a virtual environment, type:: | $ source ~/envs/tutorial-env/bin/activate (tutorial-env) $ python Python 3.5.1 (default, May 6 2016, 10:59:36) ... >>> import sys >>> sys.path ['', '/usr/local/lib/python35.zip', ..., '~/envs/tutorial-env/lib/python3.5/site-packages'] >>>
To deactivate a virtual environment, type:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d447b516-c3e2-4917-9d7f-ed58f608ce28 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,576 | supabase-export-v2 | 2f0b486da4e274cf | Introduction ============
Python applications will often use packages and modules that don't
come as part of the standard library. Applications will sometimes
need a specific version of a library, because the application may
require that a particular bug has been fixed or the application may be
written using an obsolet... | trusted_official_docs | CPython Docs | Introduction ============
Python applications will often use packages and modules that don't
come as part of the standard library. Applications will sometimes
need a specific version of a library, because the application may
require that a particular bug has been fixed or the application may be
written using an obsolet... | Introduction ============
Python applications will often use packages and modules that don't
come as part of the standard library. Applications will sometimes
need a specific version of a library, because the application may
require that a particular bug has been fixed or the application may be
written using an obsolet... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d8beec07-1f35-4dfa-92db-b3224f8ada23 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,612 | supabase-export-v2 | bcf820073bd14d32 | --- Metadata-Version: 2.0 Name: requests Version: 2.7.0 Summary: Python HTTP for Humans. Home-page: http://python-requests.org Author: Kenneth Reitz Author-email: me@kennethreitz.com License: Apache 2.0 Location: /Users/akuchling/envs/tutorial-env/lib/python3.4/site-packages Requires:
``python -m pip list`` will displa... | trusted_official_docs | CPython Docs | --- Metadata-Version: 2.0 Name: requests Version: 2.7.0 Summary: Python HTTP for Humans. Home-page: http://python-requests.org Author: Kenneth Reitz Author-email: me@kennethreitz.com License: Apache 2.0 Location: /Users/akuchling/envs/tutorial-env/lib/python3.4/site-packages Requires:
``python -m pip list`` will displa... | --- Metadata-Version: 2.0 Name: requests Version: 2.7.0 Summary: Python HTTP for Humans. Home-page: http://python-requests.org Author: Kenneth Reitz Author-email: me@kennethreitz.com License: Apache 2.0 Location: /Users/akuchling/envs/tutorial-env/lib/python3.4/site-packages Requires:
``python -m pip list`` will displa... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ed3724a7-4b19-4593-8ddf-0765ce469875 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,599 | supabase-export-v2 | 45e2e6b25ffceca0 | ``pip`` has a number of subcommands: "install", "uninstall", "freeze", etc. (Consult the :ref:`installing-index` guide for complete documentation for ``pip``.)
You can install the latest version of a package by specifying a package's name: | trusted_official_docs | CPython Docs | ``pip`` has a number of subcommands: "install", "uninstall", "freeze", etc. (Consult the :ref:`installing-index` guide for complete documentation for ``pip``.)
You can install the latest version of a package by specifying a package's name: | ``pip`` has a number of subcommands: "install", "uninstall", "freeze", etc. (Consult the :ref:`installing-index` guide for complete documentation for ``pip``.)
You can install the latest version of a package by specifying a package's name: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f254022a-f532-47ac-915b-55679a5c65d8 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,597 | supabase-export-v2 | bf95bf6b456d7699 | Managing Packages with pip ==========================
You can install, upgrade, and remove packages using a program called
:program:`pip`. By default ``pip`` will install packages from the `Python
Package Index <https://pypi.org>`_. You can browse the Python
Package Index by going to it in your web browser. | trusted_official_docs | CPython Docs | Managing Packages with pip ==========================
You can install, upgrade, and remove packages using a program called
:program:`pip`. By default ``pip`` will install packages from the `Python
Package Index <https://pypi.org>`_. You can browse the Python
Package Index by going to it in your web browser. | Managing Packages with pip ==========================
You can install, upgrade, and remove packages using a program called
:program:`pip`. By default ``pip`` will install packages from the `Python
Package Index <https://pypi.org>`_. You can browse the Python
Package Index by going to it in your web browser. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fb692ba8-794f-4187-bd30-ff914dddddb7 | CPython Docs | file://datasets/cpython/Doc/tutorial/venv.rst | unknown | 53a7e13f-0005-4f51-a36f-f6111cfabb2e | 53,618 | supabase-export-v2 | e9a135d3dd758003 | (tutorial-env) $ python -m pip freeze > requirements.txt (tutorial-env) $ cat requirements.txt novas==3.1.1.3 numpy==1.9.2 requests==2.7.0
The ``requirements.txt`` can then be committed to version control and
shipped as part of an application. Users can then install all the
necessary packages with ``install -r``: | trusted_official_docs | CPython Docs | (tutorial-env) $ python -m pip freeze > requirements.txt (tutorial-env) $ cat requirements.txt novas==3.1.1.3 numpy==1.9.2 requests==2.7.0
The ``requirements.txt`` can then be committed to version control and
shipped as part of an application. Users can then install all the
necessary packages with ``install -r``: | (tutorial-env) $ python -m pip freeze > requirements.txt (tutorial-env) $ cat requirements.txt novas==3.1.1.3 numpy==1.9.2 requests==2.7.0
The ``requirements.txt`` can then be committed to version control and
shipped as part of an application. Users can then install all the
necessary packages with ``install -r``: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
13ca528c-24d9-442b-934d-94843529591c | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,638 | supabase-export-v2 | 1e992a25d358968c | Surrounding the placeholder with braces allows it to be followed by more alphanumeric letters with no intervening spaces. Writing ``$$`` creates a single escaped ``$``::
>>> from string import Template
>>> t = Template('${village}folk send $$10 to $cause.')
>>> t.substitute(village='Nottingham', cause='the ditch fund... | trusted_official_docs | CPython Docs | Surrounding the placeholder with braces allows it to be followed by more alphanumeric letters with no intervening spaces. Writing ``$$`` creates a single escaped ``$``::
>>> from string import Template
>>> t = Template('${village}folk send $$10 to $cause.')
>>> t.substitute(village='Nottingham', cause='the ditch fund... | Surrounding the placeholder with braces allows it to be followed by more alphanumeric letters with no intervening spaces. Writing ``$$`` creates a single escaped ``$``::
>>> from string import Template
>>> t = Template('${village}folk send $$10 to $cause.')
>>> t.substitute(village='Nottingham', cause='the ditch fund... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
13fdf048-100a-414e-9b4f-92a5cf932815 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,672 | supabase-export-v2 | 95309d99807c2df8 | through email, datagrams, sockets, or to an HTTP Server. New filters can select different routing based on message priority: :const:`~logging.DEBUG`, :const:`~logging.INFO`, :const:`~logging.WARNING`, :const:`~logging.ERROR`, and :const:`~logging.CRITICAL`.
The logging system can be configured directly from Python or c... | trusted_official_docs | CPython Docs | through email, datagrams, sockets, or to an HTTP Server. New filters can select different routing based on message priority: :const:`~logging.DEBUG`, :const:`~logging.INFO`, :const:`~logging.WARNING`, :const:`~logging.ERROR`, and :const:`~logging.CRITICAL`.
The logging system can be configured directly from Python or c... | through email, datagrams, sockets, or to an HTTP Server. New filters can select different routing based on message priority: :const:`~logging.DEBUG`, :const:`~logging.INFO`, :const:`~logging.WARNING`, :const:`~logging.ERROR`, and :const:`~logging.CRITICAL`.
The logging system can be configured directly from Python or c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1586e043-4a88-443b-a042-3aa11ec0ad2d | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,684 | supabase-export-v2 | ab5db3379038def2 | and pops from the left side but slower lookups in the middle. These objects are well suited for implementing queues and breadth first tree searches::
>>> from collections import deque
>>> d = deque(["task1", "task2", "task3"])
>>> d.append("task4")
>>> print("Handling", d.popleft())
Handling task1 | trusted_official_docs | CPython Docs | and pops from the left side but slower lookups in the middle. These objects are well suited for implementing queues and breadth first tree searches::
>>> from collections import deque
>>> d = deque(["task1", "task2", "task3"])
>>> d.append("task4")
>>> print("Handling", d.popleft())
Handling task1 | and pops from the left side but slower lookups in the middle. These objects are well suited for implementing queues and breadth first tree searches::
>>> from collections import deque
>>> d = deque(["task1", "task2", "task3"])
>>> d.append("task4")
>>> print("Handling", d.popleft())
Handling task1 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
24db77b3-d1bd-4a16-9633-695df68f4e35 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,633 | supabase-export-v2 | cf4d68116be8d24d | method is just like fill() except that it returns a list of strings instead of one big string with newlines to separate the wrapped lines.
The :mod:`locale` module accesses a database of culture specific data formats. The grouping attribute of locale's format function provides a direct way of
formatting numbers with gr... | trusted_official_docs | CPython Docs | method is just like fill() except that it returns a list of strings instead of one big string with newlines to separate the wrapped lines.
The :mod:`locale` module accesses a database of culture specific data formats. The grouping attribute of locale's format function provides a direct way of
formatting numbers with gr... | method is just like fill() except that it returns a list of strings instead of one big string with newlines to separate the wrapped lines.
The :mod:`locale` module accesses a database of culture specific data formats. The grouping attribute of locale's format function provides a direct way of
formatting numbers with gr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
295c5fd2-9df4-48eb-ae9c-e8a86e649b68 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,701 | supabase-export-v2 | 5b5456c8824e1d15 | Decimal('1.0') True >>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0 False
The :mod:`decimal` module provides arithmetic with as much precision as needed:: | trusted_official_docs | CPython Docs | Decimal('1.0') True >>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0 False
The :mod:`decimal` module provides arithmetic with as much precision as needed:: | Decimal('1.0') True >>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0 False
The :mod:`decimal` module provides arithmetic with as much precision as needed:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2ac90010-5fd1-4cea-b4da-3bccc29c8c57 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,642 | supabase-export-v2 | fd74aadb9074838d | renaming utility for a photo browser may elect to use percent signs for placeholders such as the current date, image sequence number, or file format::
>>> import time, os.path
>>> photofiles = ['img_1074.jpg', 'img_1076.jpg', 'img_1077.jpg']
>>> class BatchRename(Template):
... delimiter = '%'
... >>> fmt = input('... | trusted_official_docs | CPython Docs | renaming utility for a photo browser may elect to use percent signs for placeholders such as the current date, image sequence number, or file format::
>>> import time, os.path
>>> photofiles = ['img_1074.jpg', 'img_1076.jpg', 'img_1077.jpg']
>>> class BatchRename(Template):
... delimiter = '%'
... >>> fmt = input('... | renaming utility for a photo browser may elect to use percent signs for placeholders such as the current date, image sequence number, or file format::
>>> import time, os.path
>>> photofiles = ['img_1074.jpg', 'img_1076.jpg', 'img_1077.jpg']
>>> class BatchRename(Template):
... delimiter = '%'
... >>> fmt = input('... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2b2d31c5-99af-428a-a07a-1a7c616218d8 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,667 | supabase-export-v2 | c7b86766e397f7d1 | The :mod:`logging` module offers a full featured and flexible logging system. At its simplest, log messages are sent to a file or to ``sys.stderr``::
import logging
logging.debug('Debugging information')
logging.info('Informational message')
logging.warning('Warning:config file %s not found', 'server.conf')
logging... | trusted_official_docs | CPython Docs | The :mod:`logging` module offers a full featured and flexible logging system. At its simplest, log messages are sent to a file or to ``sys.stderr``::
import logging
logging.debug('Debugging information')
logging.info('Informational message')
logging.warning('Warning:config file %s not found', 'server.conf')
logging... | The :mod:`logging` module offers a full featured and flexible logging system. At its simplest, log messages are sent to a file or to ``sys.stderr``::
import logging
logging.debug('Debugging information')
logging.info('Informational message')
logging.warning('Warning:config file %s not found', 'server.conf')
logging... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
361b4575-d58c-438d-8064-ff252fe3cdf6 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,683 | supabase-export-v2 | 3a28a00e12ecebb6 | >>> from array import array >>> a = array('H', [4000, 10, 700, 22222]) >>> sum(a) 26932 >>> a[1:3] array('H', [10, 700])
The :mod:`collections` module provides a :class:`~collections.deque` object
that is like a list with faster appends and pops from the left side but slower
lookups in the middle. These objects are wel... | trusted_official_docs | CPython Docs | >>> from array import array >>> a = array('H', [4000, 10, 700, 22222]) >>> sum(a) 26932 >>> a[1:3] array('H', [10, 700])
The :mod:`collections` module provides a :class:`~collections.deque` object
that is like a list with faster appends and pops from the left side but slower
lookups in the middle. These objects are wel... | >>> from array import array >>> a = array('H', [4000, 10, 700, 22222]) >>> sum(a) 26932 >>> a[1:3] array('H', [10, 700])
The :mod:`collections` module provides a :class:`~collections.deque` object
that is like a list with faster appends and pops from the left side but slower
lookups in the middle. These objects are wel... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3e9027b8-e1ae-429c-a06d-afd415765b5f | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,693 | supabase-export-v2 | 9eba67ddbda631b3 | Decimal floating-point arithmetic =================================
The :mod:`decimal` module offers a :class:`~decimal.Decimal` datatype for
decimal floating-point arithmetic. Compared to the built-in :class:`float`
implementation of binary floating point, the class is especially helpful for | trusted_official_docs | CPython Docs | Decimal floating-point arithmetic =================================
The :mod:`decimal` module offers a :class:`~decimal.Decimal` datatype for
decimal floating-point arithmetic. Compared to the built-in :class:`float`
implementation of binary floating point, the class is especially helpful for | Decimal floating-point arithmetic =================================
The :mod:`decimal` module offers a :class:`~decimal.Decimal` datatype for
decimal floating-point arithmetic. Compared to the built-in :class:`float`
implementation of binary floating point, the class is especially helpful for | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
409720b7-a103-498e-8f3b-4c2ad10dd747 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,680 | supabase-export-v2 | 4f7b106df4e0a741 | Tools for working with lists ============================
Many data structure needs can be met with the built-in list type. However,
sometimes there is a need for alternative implementations with different
performance trade-offs. | trusted_official_docs | CPython Docs | Tools for working with lists ============================
Many data structure needs can be met with the built-in list type. However,
sometimes there is a need for alternative implementations with different
performance trade-offs. | Tools for working with lists ============================
Many data structure needs can be met with the built-in list type. However,
sometimes there is a need for alternative implementations with different
performance trade-offs. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4a31bebb-66e7-40fd-a3c0-5a44dd365a4d | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,643 | supabase-export-v2 | a551a37de7c06eb7 | >>> class BatchRename(Template): ... delimiter = '%' ... >>> fmt = input('Enter rename style (%d-date %n-seqnum %f-format): ') Enter rename style (%d-date %n-seqnum %f-format): Ashley_%n%f
>>> t = BatchRename(fmt)
>>> date = time.strftime('%d%b%y')
>>> for i, filename in enumerate(photofiles):
... base, ext = os.pat... | trusted_official_docs | CPython Docs | >>> class BatchRename(Template): ... delimiter = '%' ... >>> fmt = input('Enter rename style (%d-date %n-seqnum %f-format): ') Enter rename style (%d-date %n-seqnum %f-format): Ashley_%n%f
>>> t = BatchRename(fmt)
>>> date = time.strftime('%d%b%y')
>>> for i, filename in enumerate(photofiles):
... base, ext = os.pat... | >>> class BatchRename(Template): ... delimiter = '%' ... >>> fmt = input('Enter rename style (%d-date %n-seqnum %f-format): ') Enter rename style (%d-date %n-seqnum %f-format): Ashley_%n%f
>>> t = BatchRename(fmt)
>>> date = time.strftime('%d%b%y')
>>> for i, filename in enumerate(photofiles):
... base, ext = os.pat... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4bf43e5c-43e2-42f6-8a5b-b77db6a2528b | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,687 | supabase-export-v2 | bc7620712a29858c | unsearched = deque([starting_node]) def breadth_first_search(unsearched): node = unsearched.popleft() for m in gen_moves(node): if is_goal(m): return m unsearched.append(m)
In addition to alternative list implementations, the library also offers other
tools such as the :mod:`bisect` module with functions for manipulati... | trusted_official_docs | CPython Docs | unsearched = deque([starting_node]) def breadth_first_search(unsearched): node = unsearched.popleft() for m in gen_moves(node): if is_goal(m): return m unsearched.append(m)
In addition to alternative list implementations, the library also offers other
tools such as the :mod:`bisect` module with functions for manipulati... | unsearched = deque([starting_node]) def breadth_first_search(unsearched): node = unsearched.popleft() for m in gen_moves(node): if is_goal(m): return m unsearched.append(m)
In addition to alternative list implementations, the library also offers other
tools such as the :mod:`bisect` module with functions for manipulati... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4de3007a-edb2-4eb6-bb6e-acde369fca2d | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,677 | supabase-export-v2 | 4af1a1e46774397b | is automatically removed from a weakref table and a callback is triggered for weakref objects. Typical applications include caching objects that are expensive to create::
>>> import weakref, gc
>>> class A:
... def __init__(self, value):
... self.value = value
... def __repr__(self):
... return str(self.value)
..... | trusted_official_docs | CPython Docs | is automatically removed from a weakref table and a callback is triggered for weakref objects. Typical applications include caching objects that are expensive to create::
>>> import weakref, gc
>>> class A:
... def __init__(self, value):
... self.value = value
... def __repr__(self):
... return str(self.value)
..... | is automatically removed from a weakref table and a callback is triggered for weakref objects. Typical applications include caching objects that are expensive to create::
>>> import weakref, gc
>>> class A:
... def __init__(self, value):
... self.value = value
... def __repr__(self):
... return str(self.value)
..... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4f62630a-68bf-4db9-a66f-de7ae42cee1a | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,639 | supabase-export-v2 | 4384cdc7ed4ba064 | >>> from string import Template >>> t = Template('${village}folk send $$10 to $cause.') >>> t.substitute(village='Nottingham', cause='the ditch fund') 'Nottinghamfolk send $10 to the ditch fund.'
The :meth:`~string.Template.substitute` method raises a :exc:`KeyError` when a
placeholder is not supplied in a dictionary o... | trusted_official_docs | CPython Docs | >>> from string import Template >>> t = Template('${village}folk send $$10 to $cause.') >>> t.substitute(village='Nottingham', cause='the ditch fund') 'Nottinghamfolk send $10 to the ditch fund.'
The :meth:`~string.Template.substitute` method raises a :exc:`KeyError` when a
placeholder is not supplied in a dictionary o... | >>> from string import Template >>> t = Template('${village}folk send $$10 to $cause.') >>> t.substitute(village='Nottingham', cause='the ditch fund') 'Nottinghamfolk send $10 to the ditch fund.'
The :meth:`~string.Template.substitute` method raises a :exc:`KeyError` when a
placeholder is not supplied in a dictionary o... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4fe6ca8b-f763-486a-95fa-4276155f67ba | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,689 | supabase-export-v2 | 3767797971be27db | = [(100, 'perl'), (200, 'tcl'), (400, 'lua'), (500, 'python')] >>> bisect.insort(scores, (300, 'ruby')) >>> scores [(100, 'perl'), (200, 'tcl'), (300, 'ruby'), (400, 'lua'), (500, 'python')]
The :mod:`heapq` module provides functions for implementing heaps based on
regular lists. The lowest valued entry is always kept ... | trusted_official_docs | CPython Docs | = [(100, 'perl'), (200, 'tcl'), (400, 'lua'), (500, 'python')] >>> bisect.insort(scores, (300, 'ruby')) >>> scores [(100, 'perl'), (200, 'tcl'), (300, 'ruby'), (400, 'lua'), (500, 'python')]
The :mod:`heapq` module provides functions for implementing heaps based on
regular lists. The lowest valued entry is always kept ... | = [(100, 'perl'), (200, 'tcl'), (400, 'lua'), (500, 'python')] >>> bisect.insort(scores, (300, 'ruby')) >>> scores [(100, 'perl'), (200, 'tcl'), (300, 'ruby'), (400, 'lua'), (500, 'python')]
The :mod:`heapq` module provides functions for implementing heaps based on
regular lists. The lowest valued entry is always kept ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
514f2c8f-d287-41e9-a3a5-d2c042e9ffa4 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,631 | supabase-export-v2 | 97f0927521c0fa19 | pprint >>> t = [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta', ... 'yellow'], 'blue']]] ... >>> pprint.pprint(t, width=30) [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta', 'yellow'], 'blue']]]
The :mod:`textwrap` module formats paragraphs of text to fit a given screen
width:: | trusted_official_docs | CPython Docs | pprint >>> t = [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta', ... 'yellow'], 'blue']]] ... >>> pprint.pprint(t, width=30) [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta', 'yellow'], 'blue']]]
The :mod:`textwrap` module formats paragraphs of text to fit a given screen
width:: | pprint >>> t = [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta', ... 'yellow'], 'blue']]] ... >>> pprint.pprint(t, width=30) [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta', 'yellow'], 'blue']]]
The :mod:`textwrap` module formats paragraphs of text to fit a given screen
width:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
52493806-b8f6-4821-a2a3-63e8f66c65bb | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,624 | supabase-export-v2 | 79f045556b9b381e | ********************************************** Brief tour of the standard library --- part II **********************************************
This second tour covers more advanced modules that support professional
programming needs. These modules rarely occur in small scripts. | trusted_official_docs | CPython Docs | ********************************************** Brief tour of the standard library --- part II **********************************************
This second tour covers more advanced modules that support professional
programming needs. These modules rarely occur in small scripts. | ********************************************** Brief tour of the standard library --- part II **********************************************
This second tour covers more advanced modules that support professional
programming needs. These modules rarely occur in small scripts. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
574b5fda-6110-4427-9f31-f13c2f498229 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,632 | supabase-export-v2 | dbc77e13ee2dd491 | The :mod:`textwrap` module formats paragraphs of text to fit a given screen width::
>>> import textwrap
>>> doc = """The wrap() method is just like fill() except that it returns
... a list of strings instead of one big string with newlines to separate
... the wrapped lines."""
... >>> print(textwrap.fill(doc, width... | trusted_official_docs | CPython Docs | The :mod:`textwrap` module formats paragraphs of text to fit a given screen width::
>>> import textwrap
>>> doc = """The wrap() method is just like fill() except that it returns
... a list of strings instead of one big string with newlines to separate
... the wrapped lines."""
... >>> print(textwrap.fill(doc, width... | The :mod:`textwrap` module formats paragraphs of text to fit a given screen width::
>>> import textwrap
>>> doc = """The wrap() method is just like fill() except that it returns
... a list of strings instead of one big string with newlines to separate
... the wrapped lines."""
... >>> print(textwrap.fill(doc, width... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6381f068-5476-4b0f-9573-7d6892891beb | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,675 | supabase-export-v2 | 5422f51dacd0a464 | Weak references ===============
Python does automatic memory management (reference counting for most objects and
:term:`garbage collection` to eliminate cycles). The memory is freed shortly
after the last reference to it has been eliminated. | trusted_official_docs | CPython Docs | Weak references ===============
Python does automatic memory management (reference counting for most objects and
:term:`garbage collection` to eliminate cycles). The memory is freed shortly
after the last reference to it has been eliminated. | Weak references ===============
Python does automatic memory management (reference counting for most objects and
:term:`garbage collection` to eliminate cycles). The memory is freed shortly
after the last reference to it has been eliminated. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
68660b29-c3de-4624-aeb5-ac96a5478a4b | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,688 | supabase-export-v2 | 9e670f3884d8369e | In addition to alternative list implementations, the library also offers other tools such as the :mod:`bisect` module with functions for manipulating sorted lists::
>>> import bisect
>>> scores = [(100, 'perl'), (200, 'tcl'), (400, 'lua'), (500, 'python')]
>>> bisect.insort(scores, (300, 'ruby'))
>>> scores
[(100, ... | trusted_official_docs | CPython Docs | In addition to alternative list implementations, the library also offers other tools such as the :mod:`bisect` module with functions for manipulating sorted lists::
>>> import bisect
>>> scores = [(100, 'perl'), (200, 'tcl'), (400, 'lua'), (500, 'python')]
>>> bisect.insort(scores, (300, 'ruby'))
>>> scores
[(100, ... | In addition to alternative list implementations, the library also offers other tools such as the :mod:`bisect` module with functions for manipulating sorted lists::
>>> import bisect
>>> scores = [(100, 'perl'), (200, 'tcl'), (400, 'lua'), (500, 'python')]
>>> bisect.insort(scores, (300, 'ruby'))
>>> scores
[(100, ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
689ab2eb-0a4b-4856-ac3e-61957cf97db1 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,694 | supabase-export-v2 | a3cbe05daee70593 | module offers a :class:`~decimal.Decimal` datatype for decimal floating-point arithmetic. Compared to the built-in :class:`float` implementation of binary floating point, the class is especially helpful for
* financial applications and other uses which require exact decimal
representation,
* control over precision,
* ... | trusted_official_docs | CPython Docs | module offers a :class:`~decimal.Decimal` datatype for decimal floating-point arithmetic. Compared to the built-in :class:`float` implementation of binary floating point, the class is especially helpful for
* financial applications and other uses which require exact decimal
representation,
* control over precision,
* ... | module offers a :class:`~decimal.Decimal` datatype for decimal floating-point arithmetic. Compared to the built-in :class:`float` implementation of binary floating point, the class is especially helpful for
* financial applications and other uses which require exact decimal
representation,
* control over precision,
* ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7378918b-9c92-462e-988e-1ae31008f92a | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,652 | supabase-export-v2 | 801015753943e662 | for i in range(3): # show the first 3 file headers start += 14 fields = struct.unpack('<IIIHH', data[start:start+16]) crc32, comp_size, uncomp_size, filenamesize, extra_size = fields
start += 16
filename = data[start:start+filenamesize]
start += filenamesize
extra = data[start:start+extra_size]
print(filename, hex(... | trusted_official_docs | CPython Docs | for i in range(3): # show the first 3 file headers start += 14 fields = struct.unpack('<IIIHH', data[start:start+16]) crc32, comp_size, uncomp_size, filenamesize, extra_size = fields
start += 16
filename = data[start:start+filenamesize]
start += filenamesize
extra = data[start:start+extra_size]
print(filename, hex(... | for i in range(3): # show the first 3 file headers start += 14 fields = struct.unpack('<IIIHH', data[start:start+16]) crc32, comp_size, uncomp_size, filenamesize, extra_size = fields
start += 16
filename = data[start:start+filenamesize]
start += filenamesize
extra = data[start:start+extra_size]
print(filename, hex(... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7bef5b42-b762-441b-b418-c6918862c729 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,698 | supabase-export-v2 | 67e43a4c7a7c4bb7 | two place significance. Decimal reproduces mathematics as done by hand and avoids issues that can arise when binary floating point cannot exactly represent decimal quantities.
Exact representation enables the :class:`~decimal.Decimal` class to perform
modulo calculations and equality tests that are unsuitable for binar... | trusted_official_docs | CPython Docs | two place significance. Decimal reproduces mathematics as done by hand and avoids issues that can arise when binary floating point cannot exactly represent decimal quantities.
Exact representation enables the :class:`~decimal.Decimal` class to perform
modulo calculations and equality tests that are unsuitable for binar... | two place significance. Decimal reproduces mathematics as done by hand and avoids issues that can arise when binary floating point cannot exactly represent decimal quantities.
Exact representation enables the :class:`~decimal.Decimal` class to perform
modulo calculations and equality tests that are unsuitable for binar... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
819e61e1-61c6-4b38-a122-26b19f36a8f0 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,648 | supabase-export-v2 | 5113bea51f64f382 | Working with binary data record layouts =======================================
The :mod:`struct` module provides :func:`~struct.pack` and
:func:`~struct.unpack` functions for working with variable length binary
record formats. The following example shows
how to loop through header information in a ZIP file without usi... | trusted_official_docs | CPython Docs | Working with binary data record layouts =======================================
The :mod:`struct` module provides :func:`~struct.pack` and
:func:`~struct.unpack` functions for working with variable length binary
record formats. The following example shows
how to loop through header information in a ZIP file without usi... | Working with binary data record layouts =======================================
The :mod:`struct` module provides :func:`~struct.pack` and
:func:`~struct.unpack` functions for working with variable length binary
record formats. The following example shows
how to loop through header information in a ZIP file without usi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
822c8205-043c-41a8-bc8e-5fd3b2236652 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,681 | supabase-export-v2 | abcd31b7a33713f8 | Many data structure needs can be met with the built-in list type. However, sometimes there is a need for alternative implementations with different performance trade-offs.
The :mod:`array` module provides an :class:`~array.array` object that is like
a list that stores only homogeneous data and stores it more compactly.... | trusted_official_docs | CPython Docs | Many data structure needs can be met with the built-in list type. However, sometimes there is a need for alternative implementations with different performance trade-offs.
The :mod:`array` module provides an :class:`~array.array` object that is like
a list that stores only homogeneous data and stores it more compactly.... | Many data structure needs can be met with the built-in list type. However, sometimes there is a need for alternative implementations with different performance trade-offs.
The :mod:`array` module provides an :class:`~array.array` object that is like
a list that stores only homogeneous data and stores it more compactly.... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
83658a75-a689-45e5-9b18-4efcb7c908e0 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,645 | supabase-export-v2 | 3f821a4646f247b7 | img_1074.jpg --> Ashley_0.jpg img_1076.jpg --> Ashley_1.jpg img_1077.jpg --> Ashley_2.jpg
Another application for templating is separating program logic from the details
of multiple output formats. This makes it possible to substitute custom
templates for XML files, plain text reports, and HTML web reports. | trusted_official_docs | CPython Docs | img_1074.jpg --> Ashley_0.jpg img_1076.jpg --> Ashley_1.jpg img_1077.jpg --> Ashley_2.jpg
Another application for templating is separating program logic from the details
of multiple output formats. This makes it possible to substitute custom
templates for XML files, plain text reports, and HTML web reports. | img_1074.jpg --> Ashley_0.jpg img_1076.jpg --> Ashley_1.jpg img_1077.jpg --> Ashley_2.jpg
Another application for templating is separating program logic from the details
of multiple output formats. This makes it possible to substitute custom
templates for XML files, plain text reports, and HTML web reports. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
83d0e5c2-cb42-473d-866c-8baa413f1047 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,641 | supabase-export-v2 | 707e55e84141361a | to $owner.') >>> d = dict(item='unladen swallow') >>> t.substitute(d) Traceback (most recent call last): ... KeyError: 'owner' >>> t.safe_substitute(d) 'Return the unladen swallow to $owner.'
Template subclasses can specify a custom delimiter. For example, a batch
renaming utility for a photo browser may elect to use p... | trusted_official_docs | CPython Docs | to $owner.') >>> d = dict(item='unladen swallow') >>> t.substitute(d) Traceback (most recent call last): ... KeyError: 'owner' >>> t.safe_substitute(d) 'Return the unladen swallow to $owner.'
Template subclasses can specify a custom delimiter. For example, a batch
renaming utility for a photo browser may elect to use p... | to $owner.') >>> d = dict(item='unladen swallow') >>> t.substitute(d) Traceback (most recent call last): ... KeyError: 'owner' >>> t.safe_substitute(d) 'Return the unladen swallow to $owner.'
Template subclasses can specify a custom delimiter. For example, a batch
renaming utility for a photo browser may elect to use p... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
83f292fd-4fd0-432e-b202-7c85367bb0f7 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,637 | supabase-export-v2 | 8a247798a5c99231 | versatile :class:`~string.Template` class with a simplified syntax suitable for editing by end-users. This allows users to customize their applications without having to alter the application.
The format uses placeholder names formed by ``$`` with valid Python identifiers
(alphanumeric characters and underscores). Surr... | trusted_official_docs | CPython Docs | versatile :class:`~string.Template` class with a simplified syntax suitable for editing by end-users. This allows users to customize their applications without having to alter the application.
The format uses placeholder names formed by ``$`` with valid Python identifiers
(alphanumeric characters and underscores). Surr... | versatile :class:`~string.Template` class with a simplified syntax suitable for editing by end-users. This allows users to customize their applications without having to alter the application.
The format uses placeholder names formed by ``$`` with valid Python identifiers
(alphanumeric characters and underscores). Surr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
868457c2-b9d7-4de2-8a75-5b6d95ddbe9a | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,695 | supabase-export-v2 | bfd4f666f9ea739c | legal or regulatory requirements, * tracking of significant decimal places, or * applications where the user expects the results to match calculations done by hand.
For example, calculating a 5% tax on a 70 cent phone charge gives different
results in decimal floating point and binary floating point. The difference
bec... | trusted_official_docs | CPython Docs | legal or regulatory requirements, * tracking of significant decimal places, or * applications where the user expects the results to match calculations done by hand.
For example, calculating a 5% tax on a 70 cent phone charge gives different
results in decimal floating point and binary floating point. The difference
bec... | legal or regulatory requirements, * tracking of significant decimal places, or * applications where the user expects the results to match calculations done by hand.
For example, calculating a 5% tax on a 70 cent phone charge gives different
results in decimal floating point and binary floating point. The difference
bec... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8fd16774-27f2-473a-bdff-7285ff61acef | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,663 | supabase-export-v2 | 0370f74c1941d746 | background.join() # Wait for the background task to finish print('Main program waited until background was done.')
The principal challenge of multi-threaded applications is coordinating threads
that share data or other resources. To that end, the threading module provides
a number of synchronization primitives includin... | trusted_official_docs | CPython Docs | background.join() # Wait for the background task to finish print('Main program waited until background was done.')
The principal challenge of multi-threaded applications is coordinating threads
that share data or other resources. To that end, the threading module provides
a number of synchronization primitives includin... | background.join() # Wait for the background task to finish print('Main program waited until background was done.')
The principal challenge of multi-threaded applications is coordinating threads
that share data or other resources. To that end, the threading module provides
a number of synchronization primitives includin... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
95a80131-6ef6-471e-8d3e-834382dab031 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,644 | supabase-export-v2 | 879f07b241049de2 | date = time.strftime('%d%b%y') >>> for i, filename in enumerate(photofiles): ... base, ext = os.path.splitext(filename) ... newname = t.substitute(d=date, n=i, f=ext) ... print('{0} --> {1}'.format(filename, newname))
img_1074.jpg --> Ashley_0.jpg
img_1076.jpg --> Ashley_1.jpg
img_1077.jpg --> Ashley_2.jpg | trusted_official_docs | CPython Docs | date = time.strftime('%d%b%y') >>> for i, filename in enumerate(photofiles): ... base, ext = os.path.splitext(filename) ... newname = t.substitute(d=date, n=i, f=ext) ... print('{0} --> {1}'.format(filename, newname))
img_1074.jpg --> Ashley_0.jpg
img_1076.jpg --> Ashley_1.jpg
img_1077.jpg --> Ashley_2.jpg | date = time.strftime('%d%b%y') >>> for i, filename in enumerate(photofiles): ... base, ext = os.path.splitext(filename) ... newname = t.substitute(d=date, n=i, f=ext) ... print('{0} --> {1}'.format(filename, newname))
img_1074.jpg --> Ashley_0.jpg
img_1076.jpg --> Ashley_1.jpg
img_1077.jpg --> Ashley_2.jpg | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9b30c1f8-fc5d-467d-b9e4-ecf69fc135bd | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,636 | supabase-export-v2 | fc3b8706c068cdaf | Templating ==========
The :mod:`string` module includes a versatile :class:`~string.Template` class
with a simplified syntax suitable for editing by end-users. This allows users
to customize their applications without having to alter the application. | trusted_official_docs | CPython Docs | Templating ==========
The :mod:`string` module includes a versatile :class:`~string.Template` class
with a simplified syntax suitable for editing by end-users. This allows users
to customize their applications without having to alter the application. | Templating ==========
The :mod:`string` module includes a versatile :class:`~string.Template` class
with a simplified syntax suitable for editing by end-users. This allows users
to customize their applications without having to alter the application. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9b495150-a66c-4a3d-b85b-d80bd6d5fc7a | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,699 | supabase-export-v2 | 3d9e01ed01fa1de8 | Exact representation enables the :class:`~decimal.Decimal` class to perform modulo calculations and equality tests that are unsuitable for binary floating point::
>>> Decimal('1.00') % Decimal('.10')
Decimal('0.00')
>>> 1.00 % 0.10
0.09999999999999995 | trusted_official_docs | CPython Docs | Exact representation enables the :class:`~decimal.Decimal` class to perform modulo calculations and equality tests that are unsuitable for binary floating point::
>>> Decimal('1.00') % Decimal('.10')
Decimal('0.00')
>>> 1.00 % 0.10
0.09999999999999995 | Exact representation enables the :class:`~decimal.Decimal` class to perform modulo calculations and equality tests that are unsuitable for binary floating point::
>>> Decimal('1.00') % Decimal('.10')
Decimal('0.00')
>>> 1.00 % 0.10
0.09999999999999995 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a4aa0160-82f7-48cb-a09a-60f9fd8539ec | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,664 | supabase-export-v2 | 8ace23ae801c9ab1 | that share data or other resources. To that end, the threading module provides a number of synchronization primitives including locks, events, condition variables, and semaphores.
While those tools are powerful, minor design errors can result in problems that
are difficult to reproduce. So, the preferred approach to ta... | trusted_official_docs | CPython Docs | that share data or other resources. To that end, the threading module provides a number of synchronization primitives including locks, events, condition variables, and semaphores.
While those tools are powerful, minor design errors can result in problems that
are difficult to reproduce. So, the preferred approach to ta... | that share data or other resources. To that end, the threading module provides a number of synchronization primitives including locks, events, condition variables, and semaphores.
While those tools are powerful, minor design errors can result in problems that
are difficult to reproduce. So, the preferred approach to ta... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a78f8b09-ce5b-4e84-8944-c75d05b832f1 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,671 | supabase-export-v2 | cc4695012955bd1c | WARNING:root:Warning:config file server.conf not found ERROR:root:Error occurred CRITICAL:root:Critical error -- shutting down
By default, informational and debugging messages are suppressed and the output
is sent to standard error. Other output options include routing messages
through email, datagrams, sockets, or to ... | trusted_official_docs | CPython Docs | WARNING:root:Warning:config file server.conf not found ERROR:root:Error occurred CRITICAL:root:Critical error -- shutting down
By default, informational and debugging messages are suppressed and the output
is sent to standard error. Other output options include routing messages
through email, datagrams, sockets, or to ... | WARNING:root:Warning:config file server.conf not found ERROR:root:Error occurred CRITICAL:root:Critical error -- shutting down
By default, informational and debugging messages are suppressed and the output
is sent to standard error. Other output options include routing messages
through email, datagrams, sockets, or to ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b4328888-715f-4686-940c-78229b7796c7 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,634 | supabase-export-v2 | 37394719ed60d0c8 | accesses a database of culture specific data formats. The grouping attribute of locale's format function provides a direct way of formatting numbers with group separators::
>>> import locale
>>> locale.setlocale(locale.LC_ALL, 'English_United States.1252')
'English_United States.1252'
>>> conv = locale.localeconv() ... | trusted_official_docs | CPython Docs | accesses a database of culture specific data formats. The grouping attribute of locale's format function provides a direct way of formatting numbers with group separators::
>>> import locale
>>> locale.setlocale(locale.LC_ALL, 'English_United States.1252')
'English_United States.1252'
>>> conv = locale.localeconv() ... | accesses a database of culture specific data formats. The grouping attribute of locale's format function provides a direct way of formatting numbers with group separators::
>>> import locale
>>> locale.setlocale(locale.LC_ALL, 'English_United States.1252')
'English_United States.1252'
>>> conv = locale.localeconv() ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b979d642-27b1-4242-af39-fd3564f73bdf | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,628 | supabase-export-v2 | 1319e549b7787bf9 | The :mod:`reprlib` module provides a version of :func:`repr` customized for abbreviated displays of large or deeply nested containers::
>>> import reprlib
>>> reprlib.repr(set('supercalifragilisticexpialidocious'))
"{'a', 'c', 'd', 'e', 'f', 'g', ...}" | trusted_official_docs | CPython Docs | The :mod:`reprlib` module provides a version of :func:`repr` customized for abbreviated displays of large or deeply nested containers::
>>> import reprlib
>>> reprlib.repr(set('supercalifragilisticexpialidocious'))
"{'a', 'c', 'd', 'e', 'f', 'g', ...}" | The :mod:`reprlib` module provides a version of :func:`repr` customized for abbreviated displays of large or deeply nested containers::
>>> import reprlib
>>> reprlib.repr(set('supercalifragilisticexpialidocious'))
"{'a', 'c', 'd', 'e', 'f', 'g', ...}" | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c20a6a9d-dae4-40a8-bbc1-6cb0e46b3a3d | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,697 | supabase-export-v2 | 8dbe0e18a05b3c20 | >>> from decimal import * >>> round(Decimal('0.70') * Decimal('1.05'), 2) Decimal('0.74') >>> round(.70 * 1.05, 2) 0.73
The :class:`~decimal.Decimal` result keeps a trailing zero, automatically
inferring four place significance from multiplicands with two place
significance. Decimal reproduces mathematics as done by ha... | trusted_official_docs | CPython Docs | >>> from decimal import * >>> round(Decimal('0.70') * Decimal('1.05'), 2) Decimal('0.74') >>> round(.70 * 1.05, 2) 0.73
The :class:`~decimal.Decimal` result keeps a trailing zero, automatically
inferring four place significance from multiplicands with two place
significance. Decimal reproduces mathematics as done by ha... | >>> from decimal import * >>> round(Decimal('0.70') * Decimal('1.05'), 2) Decimal('0.74') >>> round(.70 * 1.05, 2) 0.73
The :class:`~decimal.Decimal` result keeps a trailing zero, automatically
inferring four place significance from multiplicands with two place
significance. Decimal reproduces mathematics as done by ha... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c3bbcbe5-8832-47e9-9015-d7313106d47a | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,651 | supabase-export-v2 | b5eedca62732cafd | with open('myfile.zip', 'rb') as f: data = f.read()
start = 0
for i in range(3): # show the first 3 file headers
start += 14
fields = struct.unpack('<IIIHH', data[start:start+16])
crc32, comp_size, uncomp_size, filenamesize, extra_size = fields | trusted_official_docs | CPython Docs | with open('myfile.zip', 'rb') as f: data = f.read()
start = 0
for i in range(3): # show the first 3 file headers
start += 14
fields = struct.unpack('<IIIHH', data[start:start+16])
crc32, comp_size, uncomp_size, filenamesize, extra_size = fields | with open('myfile.zip', 'rb') as f: data = f.read()
start = 0
for i in range(3): # show the first 3 file headers
start += 14
fields = struct.unpack('<IIIHH', data[start:start+16])
crc32, comp_size, uncomp_size, filenamesize, extra_size = fields | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d066b39d-9857-4853-85b4-08bc32e09550 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,700 | supabase-export-v2 | 7659dcfa56b5e8d6 | >>> Decimal('1.00') % Decimal('.10') Decimal('0.00') >>> 1.00 % 0.10 0.09999999999999995
>>> sum([Decimal('0.1')]*10) == Decimal('1.0')
True
>>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0
False | trusted_official_docs | CPython Docs | >>> Decimal('1.00') % Decimal('.10') Decimal('0.00') >>> 1.00 % 0.10 0.09999999999999995
>>> sum([Decimal('0.1')]*10) == Decimal('1.0')
True
>>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0
False | >>> Decimal('1.00') % Decimal('.10') Decimal('0.00') >>> 1.00 % 0.10 0.09999999999999995
>>> sum([Decimal('0.1')]*10) == Decimal('1.0')
True
>>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0
False | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d8693036-f711-4429-a142-beb316baa00f | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,656 | supabase-export-v2 | ddd84bf74438b443 | Multi-threading ===============
Threading is a technique for decoupling tasks which are not sequentially
dependent. Threads can be used to improve the responsiveness of applications
that accept user input while other tasks run in the background. A related use
case is running I/O in parallel with computations in another... | trusted_official_docs | CPython Docs | Multi-threading ===============
Threading is a technique for decoupling tasks which are not sequentially
dependent. Threads can be used to improve the responsiveness of applications
that accept user input while other tasks run in the background. A related use
case is running I/O in parallel with computations in another... | Multi-threading ===============
Threading is a technique for decoupling tasks which are not sequentially
dependent. Threads can be used to improve the responsiveness of applications
that accept user input while other tasks run in the background. A related use
case is running I/O in parallel with computations in another... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d9710ee9-3d55-4f4f-bba0-0468b8f81310 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,676 | supabase-export-v2 | 8d335c07d020f4fb | (reference counting for most objects and :term:`garbage collection` to eliminate cycles). The memory is freed shortly after the last reference to it has been eliminated.
This approach works fine for most applications but occasionally there is a need
to track objects only as long as they are being used by something else... | trusted_official_docs | CPython Docs | (reference counting for most objects and :term:`garbage collection` to eliminate cycles). The memory is freed shortly after the last reference to it has been eliminated.
This approach works fine for most applications but occasionally there is a need
to track objects only as long as they are being used by something else... | (reference counting for most objects and :term:`garbage collection` to eliminate cycles). The memory is freed shortly after the last reference to it has been eliminated.
This approach works fine for most applications but occasionally there is a need
to track objects only as long as they are being used by something else... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dacfa194-6ffc-4129-a076-44d67e4ae87e | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,690 | supabase-export-v2 | 3b1f55d84f2f7864 | kept at position zero. This is useful for applications which repeatedly access the smallest element but do not want to run a full list sort::
>>> from heapq import heapify, heappop, heappush
>>> data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]
>>> heapify(data) # rearrange the list into heap order
>>> heappush(data, -5) # add ... | trusted_official_docs | CPython Docs | kept at position zero. This is useful for applications which repeatedly access the smallest element but do not want to run a full list sort::
>>> from heapq import heapify, heappop, heappush
>>> data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]
>>> heapify(data) # rearrange the list into heap order
>>> heappush(data, -5) # add ... | kept at position zero. This is useful for applications which repeatedly access the smallest element but do not want to run a full list sort::
>>> from heapq import heapify, heappop, heappush
>>> data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]
>>> heapify(data) # rearrange the list into heap order
>>> heappush(data, -5) # add ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e3cd07bd-bf54-44de-8731-316692791155 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,630 | supabase-export-v2 | dd70c48a7057eb1c | by the interpreter. When the result is longer than one line, the "pretty printer" adds line breaks and indentation to more clearly reveal data structure::
>>> import pprint
>>> t = [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta',
... 'yellow'], 'blue']]]
... >>> pprint.pprint(t, width=30)
[[[['black',... | trusted_official_docs | CPython Docs | by the interpreter. When the result is longer than one line, the "pretty printer" adds line breaks and indentation to more clearly reveal data structure::
>>> import pprint
>>> t = [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta',
... 'yellow'], 'blue']]]
... >>> pprint.pprint(t, width=30)
[[[['black',... | by the interpreter. When the result is longer than one line, the "pretty printer" adds line breaks and indentation to more clearly reveal data structure::
>>> import pprint
>>> t = [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta',
... 'yellow'], 'blue']]]
... >>> pprint.pprint(t, width=30)
[[[['black',... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e882e8aa-a5d6-41d7-97f0-7b4d9f6b4da3 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,629 | supabase-export-v2 | f7b889a701b72111 | >>> import reprlib >>> reprlib.repr(set('supercalifragilisticexpialidocious')) "{'a', 'c', 'd', 'e', 'f', 'g', ...}"
The :mod:`pprint` module offers more sophisticated control over printing both
built-in and user defined objects in a way that is readable by the interpreter. When the result is longer than one line, the ... | trusted_official_docs | CPython Docs | >>> import reprlib >>> reprlib.repr(set('supercalifragilisticexpialidocious')) "{'a', 'c', 'd', 'e', 'f', 'g', ...}"
The :mod:`pprint` module offers more sophisticated control over printing both
built-in and user defined objects in a way that is readable by the interpreter. When the result is longer than one line, the ... | >>> import reprlib >>> reprlib.repr(set('supercalifragilisticexpialidocious')) "{'a', 'c', 'd', 'e', 'f', 'g', ...}"
The :mod:`pprint` module offers more sophisticated control over printing both
built-in and user defined objects in a way that is readable by the interpreter. When the result is longer than one line, the ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ec3aaa7f-66b8-4bd2-9694-6c32f9e3704e | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,657 | supabase-export-v2 | 21bf579b95b19004 | that accept user input while other tasks run in the background. A related use case is running I/O in parallel with computations in another thread.
The following code shows how the high level :mod:`threading` module can run
tasks in background while the main program continues to run:: | trusted_official_docs | CPython Docs | that accept user input while other tasks run in the background. A related use case is running I/O in parallel with computations in another thread.
The following code shows how the high level :mod:`threading` module can run
tasks in background while the main program continues to run:: | that accept user input while other tasks run in the background. A related use case is running I/O in parallel with computations in another thread.
The following code shows how the high level :mod:`threading` module can run
tasks in background while the main program continues to run:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ef38ede1-1277-4727-b530-b15473debb0e | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,682 | supabase-export-v2 | 8ab415dabee13818 | numbers stored as two byte unsigned binary numbers (typecode ``"H"``) rather than the usual 16 bytes per entry for regular lists of Python int objects::
>>> from array import array
>>> a = array('H', [4000, 10, 700, 22222])
>>> sum(a)
26932
>>> a[1:3]
array('H', [10, 700]) | trusted_official_docs | CPython Docs | numbers stored as two byte unsigned binary numbers (typecode ``"H"``) rather than the usual 16 bytes per entry for regular lists of Python int objects::
>>> from array import array
>>> a = array('H', [4000, 10, 700, 22222])
>>> sum(a)
26932
>>> a[1:3]
array('H', [10, 700]) | numbers stored as two byte unsigned binary numbers (typecode ``"H"``) rather than the usual 16 bytes per entry for regular lists of Python int objects::
>>> from array import array
>>> a = array('H', [4000, 10, 700, 22222])
>>> sum(a)
26932
>>> a[1:3]
array('H', [10, 700]) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f4949e19-1574-4f47-8b37-b7194a7b9666 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,640 | supabase-export-v2 | 67e71e86008f685a | applications, user supplied data may be incomplete and the :meth:`~string.Template.safe_substitute` method may be more appropriate --- it will leave placeholders unchanged if data is missing::
>>> t = Template('Return the $item to $owner.')
>>> d = dict(item='unladen swallow')
>>> t.substitute(d)
Traceback (most rec... | trusted_official_docs | CPython Docs | applications, user supplied data may be incomplete and the :meth:`~string.Template.safe_substitute` method may be more appropriate --- it will leave placeholders unchanged if data is missing::
>>> t = Template('Return the $item to $owner.')
>>> d = dict(item='unladen swallow')
>>> t.substitute(d)
Traceback (most rec... | applications, user supplied data may be incomplete and the :meth:`~string.Template.safe_substitute` method may be more appropriate --- it will leave placeholders unchanged if data is missing::
>>> t = Template('Return the $item to $owner.')
>>> d = dict(item='unladen swallow')
>>> t.substitute(d)
Traceback (most rec... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f7c2e343-fdcd-463b-b279-f1cd499badb3 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib2.rst | unknown | 87a45ec8-1e2d-4cc4-9521-f6a105f633cb | 53,696 | supabase-export-v2 | 48b8e2862346d6e4 | charge gives different results in decimal floating point and binary floating point. The difference becomes significant if the results are rounded to the nearest cent::
>>> from decimal import *
>>> round(Decimal('0.70') * Decimal('1.05'), 2)
Decimal('0.74')
>>> round(.70 * 1.05, 2)
0.73 | trusted_official_docs | CPython Docs | charge gives different results in decimal floating point and binary floating point. The difference becomes significant if the results are rounded to the nearest cent::
>>> from decimal import *
>>> round(Decimal('0.70') * Decimal('1.05'), 2)
Decimal('0.74')
>>> round(.70 * 1.05, 2)
0.73 | charge gives different results in decimal floating point and binary floating point. The difference becomes significant if the results are rounded to the nearest cent::
>>> from decimal import *
>>> round(Decimal('0.70') * Decimal('1.05'), 2)
Decimal('0.74')
>>> round(.70 * 1.05, 2)
0.73 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
04def8c7-b60e-4062-8b4a-4b1b77b841a4 | CPython Docs | file://datasets/cpython/Doc/tutorial/modules.rst | unknown | b861e0bf-b87a-48ad-9627-b6822a304bc5 | 53,727 | supabase-export-v2 | 0e51b1e2967d1547 | or package is frowned upon, since it often causes poorly readable code. However, it is okay to use it to save typing in interactive sessions.
If the module name is followed by :keyword:`!as`, then the name
following :keyword:`!as` is bound directly to the imported module. | trusted_official_docs | CPython Docs | or package is frowned upon, since it often causes poorly readable code. However, it is okay to use it to save typing in interactive sessions.
If the module name is followed by :keyword:`!as`, then the name
following :keyword:`!as` is bound directly to the imported module. | or package is frowned upon, since it often causes poorly readable code. However, it is okay to use it to save typing in interactive sessions.
If the module name is followed by :keyword:`!as`, then the name
following :keyword:`!as` is bound directly to the imported module. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
05f8749e-65dc-46c8-9628-1afbe946120d | CPython Docs | file://datasets/cpython/Doc/tutorial/modules.rst | unknown | b861e0bf-b87a-48ad-9627-b6822a304bc5 | 53,750 | supabase-export-v2 | 9672a6b291b32218 | .. index:: triple: module; search; path
When a module named :mod:`!spam` is imported, the interpreter first searches for
a built-in module with that name. These module names are listed in
:data:`sys.builtin_module_names`. If not found, it then searches for a file
named :file:`spam.py` in a list of directories given by ... | trusted_official_docs | CPython Docs | .. index:: triple: module; search; path
When a module named :mod:`!spam` is imported, the interpreter first searches for
a built-in module with that name. These module names are listed in
:data:`sys.builtin_module_names`. If not found, it then searches for a file
named :file:`spam.py` in a list of directories given by ... | .. index:: triple: module; search; path
When a module named :mod:`!spam` is imported, the interpreter first searches for
a built-in module with that name. These module names are listed in
:data:`sys.builtin_module_names`. If not found, it then searches for a file
named :file:`spam.py` in a list of directories given by ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
09daa709-f8a2-4ed5-8ee4-1c586f68ca5f | CPython Docs | file://datasets/cpython/Doc/tutorial/modules.rst | unknown | b861e0bf-b87a-48ad-9627-b6822a304bc5 | 53,746 | supabase-export-v2 | ff6f70589160d08f | >>> import fibo >>>
This is often used either to provide a convenient user interface to a module, or
for testing purposes (running the module as a script executes a test suite). | trusted_official_docs | CPython Docs | >>> import fibo >>>
This is often used either to provide a convenient user interface to a module, or
for testing purposes (running the module as a script executes a test suite). | >>> import fibo >>>
This is often used either to provide a convenient user interface to a module, or
for testing purposes (running the module as a script executes a test suite). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0e4ec2b4-52be-432a-a808-2cc8b73e754a | CPython Docs | file://datasets/cpython/Doc/tutorial/modules.rst | unknown | b861e0bf-b87a-48ad-9627-b6822a304bc5 | 53,769 | supabase-export-v2 | fbe6409f3b9be2ed | .. index:: pair: module; sys
Python comes with a library of standard modules, described in a separate
document, the Python Library Reference ("Library Reference" hereafter). Some
modules are built into the interpreter; these provide access to operations that
are not part of the core of the language but are nevertheless... | trusted_official_docs | CPython Docs | .. index:: pair: module; sys
Python comes with a library of standard modules, described in a separate
document, the Python Library Reference ("Library Reference" hereafter). Some
modules are built into the interpreter; these provide access to operations that
are not part of the core of the language but are nevertheless... | .. index:: pair: module; sys
Python comes with a library of standard modules, described in a separate
document, the Python Library Reference ("Library Reference" hereafter). Some
modules are built into the interpreter; these provide access to operations that
are not part of the core of the language but are nevertheless... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0f2632d1-68a2-420f-b28b-d702559d5513 | CPython Docs | file://datasets/cpython/Doc/tutorial/modules.rst | unknown | b861e0bf-b87a-48ad-9627-b6822a304bc5 | 53,714 | supabase-export-v2 | 4730610d68a53824 | If you intend to use a function often you can assign it to a local name::
>>> fib = fibo.fib
>>> fib(500)
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 | trusted_official_docs | CPython Docs | If you intend to use a function often you can assign it to a local name::
>>> fib = fibo.fib
>>> fib(500)
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 | If you intend to use a function often you can assign it to a local name::
>>> fib = fibo.fib
>>> fib(500)
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1111eceb-e160-4a3f-89d8-dcfc75507c31 | CPython Docs | file://datasets/cpython/Doc/tutorial/modules.rst | unknown | b861e0bf-b87a-48ad-9627-b6822a304bc5 | 53,752 | supabase-export-v2 | aa1c15953123cce3 | names, with the same syntax as the shell variable :envvar:`PATH`). * The installation-dependent default (by convention including a ``site-packages`` directory, handled by the :mod:`site` module).
More details are at :ref:`sys-path-init`. | trusted_official_docs | CPython Docs | names, with the same syntax as the shell variable :envvar:`PATH`). * The installation-dependent default (by convention including a ``site-packages`` directory, handled by the :mod:`site` module).
More details are at :ref:`sys-path-init`. | names, with the same syntax as the shell variable :envvar:`PATH`). * The installation-dependent default (by convention including a ``site-packages`` directory, handled by the :mod:`site` module).
More details are at :ref:`sys-path-init`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
11a188ff-964e-4726-8578-41c17a657bac | CPython Docs | file://datasets/cpython/Doc/tutorial/modules.rst | unknown | b861e0bf-b87a-48ad-9627-b6822a304bc5 | 53,765 | supabase-export-v2 | d6e0fe2d201ad8af | * The module :mod:`compileall` can create .pyc files for all modules in a directory.
* There is more detail on this process, including a flow chart of the
decisions, in :pep:`3147`. | trusted_official_docs | CPython Docs | * The module :mod:`compileall` can create .pyc files for all modules in a directory.
* There is more detail on this process, including a flow chart of the
decisions, in :pep:`3147`. | * The module :mod:`compileall` can create .pyc files for all modules in a directory.
* There is more detail on this process, including a flow chart of the
decisions, in :pep:`3147`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1341d745-25e0-4499-8582-e3908583987b | CPython Docs | file://datasets/cpython/Doc/tutorial/modules.rst | unknown | b861e0bf-b87a-48ad-9627-b6822a304bc5 | 53,777 | supabase-export-v2 | 75496f64a74c9e17 | The built-in function :func:`dir` is used to find out which names a module defines. It returns a sorted list of strings::
>>> import fibo, sys
>>> dir(fibo)
['__name__', 'fib', 'fib2']
>>> dir(sys) # doctest: +NORMALIZE_WHITESPACE
['__breakpointhook__', '__displayhook__', '__doc__', '__excepthook__',
'__interactiv... | trusted_official_docs | CPython Docs | The built-in function :func:`dir` is used to find out which names a module defines. It returns a sorted list of strings::
>>> import fibo, sys
>>> dir(fibo)
['__name__', 'fib', 'fib2']
>>> dir(sys) # doctest: +NORMALIZE_WHITESPACE
['__breakpointhook__', '__displayhook__', '__doc__', '__excepthook__',
'__interactiv... | The built-in function :func:`dir` is used to find out which names a module defines. It returns a sorted list of strings::
>>> import fibo, sys
>>> dir(fibo)
['__name__', 'fib', 'fib2']
>>> dir(sys) # doctest: +NORMALIZE_WHITESPACE
['__breakpointhook__', '__displayhook__', '__doc__', '__excepthook__',
'__interactiv... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
15afe54d-7cd5-4f0a-8f84-f96ccbdb67f2 | CPython Docs | file://datasets/cpython/Doc/tutorial/modules.rst | unknown | b861e0bf-b87a-48ad-9627-b6822a304bc5 | 53,810 | supabase-export-v2 | 3f6f6e2c7f5d2a30 | to support it, if they don't see a use for importing \* from their package. For example, the file :file:`sound/effects/__init__.py` could contain the following code::
__all__ = ["echo", "surround", "reverse"] | trusted_official_docs | CPython Docs | to support it, if they don't see a use for importing \* from their package. For example, the file :file:`sound/effects/__init__.py` could contain the following code::
__all__ = ["echo", "surround", "reverse"] | to support it, if they don't see a use for importing \* from their package. For example, the file :file:`sound/effects/__init__.py` could contain the following code::
__all__ = ["echo", "surround", "reverse"] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
16645741-7e49-474a-b770-6f22a7a8980e | CPython Docs | file://datasets/cpython/Doc/tutorial/modules.rst | unknown | b861e0bf-b87a-48ad-9627-b6822a304bc5 | 53,751 | supabase-export-v2 | fa0e53ee46b5434e | found, it then searches for a file named :file:`spam.py` in a list of directories given by the variable :data:`sys.path`. :data:`sys.path` is initialized from these locations:
* The directory containing the input script (or the current directory when no
file is specified). * :envvar:`PYTHONPATH` (a list of directory n... | trusted_official_docs | CPython Docs | found, it then searches for a file named :file:`spam.py` in a list of directories given by the variable :data:`sys.path`. :data:`sys.path` is initialized from these locations:
* The directory containing the input script (or the current directory when no
file is specified). * :envvar:`PYTHONPATH` (a list of directory n... | found, it then searches for a file named :file:`spam.py` in a list of directories given by the variable :data:`sys.path`. :data:`sys.path` is initialized from these locations:
* The directory containing the input script (or the current directory when no
file is specified). * :envvar:`PYTHONPATH` (a list of directory n... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
20ddab7a-71cb-40f0-a640-649cb7609dfc | CPython Docs | file://datasets/cpython/Doc/tutorial/modules.rst | unknown | b861e0bf-b87a-48ad-9627-b6822a304bc5 | 53,717 | supabase-export-v2 | 49cc54d7f9d6d926 | More on Modules ===============
A module can contain executable statements as well as function definitions. These statements are intended to initialize the module. They are executed only
the *first* time the module name is encountered in an import statement. [#]_
(They are also run if the file is executed as a script.) | trusted_official_docs | CPython Docs | More on Modules ===============
A module can contain executable statements as well as function definitions. These statements are intended to initialize the module. They are executed only
the *first* time the module name is encountered in an import statement. [#]_
(They are also run if the file is executed as a script.) | More on Modules ===============
A module can contain executable statements as well as function definitions. These statements are intended to initialize the module. They are executed only
the *first* time the module name is encountered in an import statement. [#]_
(They are also run if the file is executed as a script.) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
210be3e9-4080-443e-b996-2150ca54c6c1 | CPython Docs | file://datasets/cpython/Doc/tutorial/modules.rst | unknown | b861e0bf-b87a-48ad-9627-b6822a304bc5 | 53,779 | supabase-export-v2 | 9561982d2a9b2a46 | Without arguments, :func:`dir` lists the names you have defined currently::
>>> a = [1, 2, 3, 4, 5]
>>> import fibo
>>> fib = fibo.fib
>>> dir()
['__builtins__', '__name__', 'a', 'fib', 'fibo', 'sys'] | trusted_official_docs | CPython Docs | Without arguments, :func:`dir` lists the names you have defined currently::
>>> a = [1, 2, 3, 4, 5]
>>> import fibo
>>> fib = fibo.fib
>>> dir()
['__builtins__', '__name__', 'a', 'fib', 'fibo', 'sys'] | Without arguments, :func:`dir` lists the names you have defined currently::
>>> a = [1, 2, 3, 4, 5]
>>> import fibo
>>> fib = fibo.fib
>>> dir()
['__builtins__', '__name__', 'a', 'fib', 'fibo', 'sys'] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
274dbc69-f72f-4d1a-b1f3-b7de2c2edc31 | CPython Docs | file://datasets/cpython/Doc/tutorial/modules.rst | unknown | b861e0bf-b87a-48ad-9627-b6822a304bc5 | 53,739 | supabase-export-v2 | e3b1c1a7790cd004 | python fibo.py <arguments>
the code in the module will be executed, just as if you imported it, but with
the ``__name__`` set to ``"__main__"``. That means that by adding this code at
the end of your module:: | trusted_official_docs | CPython Docs | python fibo.py <arguments>
the code in the module will be executed, just as if you imported it, but with
the ``__name__`` set to ``"__main__"``. That means that by adding this code at
the end of your module:: | python fibo.py <arguments>
the code in the module will be executed, just as if you imported it, but with
the ``__name__`` set to ``"__main__"``. That means that by adding this code at
the end of your module:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
28f626c9-f873-4947-b598-71f0370bfef7 | CPython Docs | file://datasets/cpython/Doc/tutorial/modules.rst | unknown | b861e0bf-b87a-48ad-9627-b6822a304bc5 | 53,804 | supabase-export-v2 | b2f610e8894d192d | package; if not, it assumes it is a module and attempts to load it. If it fails to find it, an :exc:`ImportError` exception is raised.
Contrarily, when using syntax like ``import item.subitem.subsubitem``, each item
except for the last must be a package; the last item can be a module or a
package but can't be a class o... | trusted_official_docs | CPython Docs | package; if not, it assumes it is a module and attempts to load it. If it fails to find it, an :exc:`ImportError` exception is raised.
Contrarily, when using syntax like ``import item.subitem.subsubitem``, each item
except for the last must be a package; the last item can be a module or a
package but can't be a class o... | package; if not, it assumes it is a module and attempts to load it. If it fails to find it, an :exc:`ImportError` exception is raised.
Contrarily, when using syntax like ``import item.subitem.subsubitem``, each item
except for the last must be a package; the last item can be a module or a
package but can't be a class o... | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.