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
fa40f34d-fa6a-490a-af74-464a4b4b9a16
CPython Docs
file://datasets/cpython/Doc/using/configure.rst
unknown
44edd291-e0ea-4c98-9f18-944953c83e0b
55,887
supabase-export-v2
8bd3f349d702373c
make ^^^^ For the most part, when rebuilding after editing some code or refreshing your checkout from upstream, all you need to do is execute ``make``, which (per Make's semantics) builds the default target, the first one defined in the Makefile. By tradition (including in the CPython project) this is usually the ``all...
trusted_official_docs
CPython Docs
make ^^^^ For the most part, when rebuilding after editing some code or refreshing your checkout from upstream, all you need to do is execute ``make``, which (per Make's semantics) builds the default target, the first one defined in the Makefile. By tradition (including in the CPython project) this is usually the ``all...
make ^^^^ For the most part, when rebuilding after editing some code or refreshing your checkout from upstream, all you need to do is execute ``make``, which (per Make's semantics) builds the default target, the first one defined in the Makefile. By tradition (including in the CPython project) this is usually the ``all...
python, official-docs, cpython, P0
Local_Trusted_Corpus
fb929ff2-5bd9-48fd-916d-cc61786e13f9
CPython Docs
file://datasets/cpython/Doc/using/configure.rst
unknown
44edd291-e0ea-4c98-9f18-944953c83e0b
55,980
supabase-export-v2
a5d8b9da0c1c96ea
In particular, :envvar:`LDFLAGS` should not contain: * the compiler flag ``-L`` (for setting the search path for libraries). The ``-L`` flags are processed from left to right, and any flags in :envvar:`LDFLAGS` would take precedence over user- and package-supplied ``-L`` flags.
trusted_official_docs
CPython Docs
In particular, :envvar:`LDFLAGS` should not contain: * the compiler flag ``-L`` (for setting the search path for libraries). The ``-L`` flags are processed from left to right, and any flags in :envvar:`LDFLAGS` would take precedence over user- and package-supplied ``-L`` flags.
In particular, :envvar:`LDFLAGS` should not contain: * the compiler flag ``-L`` (for setting the search path for libraries). The ``-L`` flags are processed from left to right, and any flags in :envvar:`LDFLAGS` would take precedence over user- and package-supplied ``-L`` flags.
python, official-docs, cpython, P0
Local_Trusted_Corpus
fc5f581d-6a87-45a4-8742-bc81870327e9
CPython Docs
file://datasets/cpython/Doc/using/configure.rst
unknown
44edd291-e0ea-4c98-9f18-944953c83e0b
55,569
supabase-export-v2
a445dac4b80799e5
* Object: * incref and decref; * interpreter incref and decref; * allocations: all, 512 bytes, 4 kiB, big; * free; * to/from free lists; * dictionary materialized/dematerialized; * type cache; * optimization attempts; * optimization traces created/executed; * uops executed.
trusted_official_docs
CPython Docs
* Object: * incref and decref; * interpreter incref and decref; * allocations: all, 512 bytes, 4 kiB, big; * free; * to/from free lists; * dictionary materialized/dematerialized; * type cache; * optimization attempts; * optimization traces created/executed; * uops executed.
* Object: * incref and decref; * interpreter incref and decref; * allocations: all, 512 bytes, 4 kiB, big; * free; * to/from free lists; * dictionary materialized/dematerialized; * type cache; * optimization attempts; * optimization traces created/executed; * uops executed.
python, official-docs, cpython, P0
Local_Trusted_Corpus
fd09605a-5f6e-4f8a-afaf-36c56c5884f0
CPython Docs
file://datasets/cpython/Doc/using/configure.rst
unknown
44edd291-e0ea-4c98-9f18-944953c83e0b
55,912
supabase-export-v2
f97ae71ecf58c51e
>>> sys <module 'sys' (built-in)> >>> sys.__file__ Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'sys' has no attribute '__file__' Other C extensions are built as dynamic libraries, like the ``_asyncio`` module. They are built with the ``Py_BUILD_CORE_MODULE`` macro defin...
trusted_official_docs
CPython Docs
>>> sys <module 'sys' (built-in)> >>> sys.__file__ Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'sys' has no attribute '__file__' Other C extensions are built as dynamic libraries, like the ``_asyncio`` module. They are built with the ``Py_BUILD_CORE_MODULE`` macro defin...
>>> sys <module 'sys' (built-in)> >>> sys.__file__ Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'sys' has no attribute '__file__' Other C extensions are built as dynamic libraries, like the ``_asyncio`` module. They are built with the ``Py_BUILD_CORE_MODULE`` macro defin...
python, official-docs, cpython, P0
Local_Trusted_Corpus
052ef65f-85fe-40f1-90c1-442c91a26302
CPython Docs
file://datasets/cpython/Doc/using/index.rst
unknown
29b32e9f-48ea-4cb8-b04f-8d5f623bb143
56,014
supabase-export-v2
973cb4a31818c13a
general information on the setup of the Python environment on different platforms, the invocation of the interpreter and things that make working with Python easier. .. toctree:: :numbered: :maxdepth: 2
trusted_official_docs
CPython Docs
general information on the setup of the Python environment on different platforms, the invocation of the interpreter and things that make working with Python easier. .. toctree:: :numbered: :maxdepth: 2
general information on the setup of the Python environment on different platforms, the invocation of the interpreter and things that make working with Python easier. .. toctree:: :numbered: :maxdepth: 2
python, official-docs, cpython, P0
Local_Trusted_Corpus
ff57d064-728a-40cd-95a0-bb64e08e7717
CPython Docs
file://datasets/cpython/Doc/using/index.rst
unknown
29b32e9f-48ea-4cb8-b04f-8d5f623bb143
56,013
supabase-export-v2
563028afc8870a47
########################## Python Setup and Usage ########################## This part of the documentation is devoted to general information on the setup of the Python environment on different platforms, the invocation of the interpreter and things that make working with Python easier.
trusted_official_docs
CPython Docs
########################## Python Setup and Usage ########################## This part of the documentation is devoted to general information on the setup of the Python environment on different platforms, the invocation of the interpreter and things that make working with Python easier.
########################## Python Setup and Usage ########################## This part of the documentation is devoted to general information on the setup of the Python environment on different platforms, the invocation of the interpreter and things that make working with Python easier.
python, official-docs, cpython, P0
Local_Trusted_Corpus
087e3a4b-9c70-460b-a36f-c75b8b0a22e9
CPython Docs
file://datasets/cpython/Doc/using/editors.rst
unknown
371d1664-7537-42db-a8f6-fd0556cd2118
56,020
supabase-export-v2
c77dd84e093edee5
If you are on Linux and do not have IDLE installed see :ref:`Installing IDLE on Linux <installing_idle_on_linux>`. For more information see the :ref:`IDLE docs <idle>`. Other Editors and IDEs ======================
trusted_official_docs
CPython Docs
If you are on Linux and do not have IDLE installed see :ref:`Installing IDLE on Linux <installing_idle_on_linux>`. For more information see the :ref:`IDLE docs <idle>`. Other Editors and IDEs ======================
If you are on Linux and do not have IDLE installed see :ref:`Installing IDLE on Linux <installing_idle_on_linux>`. For more information see the :ref:`IDLE docs <idle>`. Other Editors and IDEs ======================
python, official-docs, cpython, P0
Local_Trusted_Corpus
25c872c1-2746-48b5-8d75-f2a5b3a1206d
CPython Docs
file://datasets/cpython/Doc/using/editors.rst
unknown
371d1664-7537-42db-a8f6-fd0556cd2118
56,018
supabase-export-v2
cf8a9f4b52fc6b0c
There are a number of IDEs that support Python programming language. Many editors and IDEs provide syntax highlighting, debugging tools, and :pep:`8` checks. IDLE --- Python editor and shell ================================
trusted_official_docs
CPython Docs
There are a number of IDEs that support Python programming language. Many editors and IDEs provide syntax highlighting, debugging tools, and :pep:`8` checks. IDLE --- Python editor and shell ================================
There are a number of IDEs that support Python programming language. Many editors and IDEs provide syntax highlighting, debugging tools, and :pep:`8` checks. IDLE --- Python editor and shell ================================
python, official-docs, cpython, P0
Local_Trusted_Corpus
517c7887-6b23-42f3-9222-557d36f79679
CPython Docs
file://datasets/cpython/Doc/using/editors.rst
unknown
371d1664-7537-42db-a8f6-fd0556cd2118
56,021
supabase-export-v2
10d2b50545e9bb27
Other Editors and IDEs ====================== Python's community wiki has information submitted by the community on Editors and IDEs. Please go to `Python Editors <https://wiki.python.org/moin/PythonEditors>`_ and `Integrated Development Environments <https://wiki.python.org/moin/IntegratedDevelopmentEnvironments>`_ fo...
trusted_official_docs
CPython Docs
Other Editors and IDEs ====================== Python's community wiki has information submitted by the community on Editors and IDEs. Please go to `Python Editors <https://wiki.python.org/moin/PythonEditors>`_ and `Integrated Development Environments <https://wiki.python.org/moin/IntegratedDevelopmentEnvironments>`_ fo...
Other Editors and IDEs ====================== Python's community wiki has information submitted by the community on Editors and IDEs. Please go to `Python Editors <https://wiki.python.org/moin/PythonEditors>`_ and `Integrated Development Environments <https://wiki.python.org/moin/IntegratedDevelopmentEnvironments>`_ fo...
python, official-docs, cpython, P0
Local_Trusted_Corpus
629caafa-ea5f-4b19-a55f-88b52910b212
CPython Docs
file://datasets/cpython/Doc/using/editors.rst
unknown
371d1664-7537-42db-a8f6-fd0556cd2118
56,019
supabase-export-v2
5b5d1eb94734506c
IDLE --- Python editor and shell ================================ IDLE is Python’s Integrated Development and Learning Environment and is generally bundled with Python installs. If you are on Linux and do not have IDLE installed see :ref:`Installing IDLE on Linux <installing_idle_on_linux>`. For more information see th...
trusted_official_docs
CPython Docs
IDLE --- Python editor and shell ================================ IDLE is Python’s Integrated Development and Learning Environment and is generally bundled with Python installs. If you are on Linux and do not have IDLE installed see :ref:`Installing IDLE on Linux <installing_idle_on_linux>`. For more information see th...
IDLE --- Python editor and shell ================================ IDLE is Python’s Integrated Development and Learning Environment and is generally bundled with Python installs. If you are on Linux and do not have IDLE installed see :ref:`Installing IDLE on Linux <installing_idle_on_linux>`. For more information see th...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c9a89394-79a0-4677-8161-ed1bc259cb51
CPython Docs
file://datasets/cpython/Doc/distributing/index.rst
unknown
b4fb0da5-2587-4b1b-9afb-c4ae5c4cebba
56,027
supabase-export-v2
333f1e41a222fc1c
Information and guidance on distributing Python modules and packages has been moved to the `Python Packaging User Guide`_, and the tutorial on `packaging Python projects`_. .. _Python Packaging User Guide: https://packaging.python.org/ .. _packaging Python projects: https://packaging.python.org/en/latest/tutorials/pac...
trusted_official_docs
CPython Docs
Information and guidance on distributing Python modules and packages has been moved to the `Python Packaging User Guide`_, and the tutorial on `packaging Python projects`_. .. _Python Packaging User Guide: https://packaging.python.org/ .. _packaging Python projects: https://packaging.python.org/en/latest/tutorials/pac...
Information and guidance on distributing Python modules and packages has been moved to the `Python Packaging User Guide`_, and the tutorial on `packaging Python projects`_. .. _Python Packaging User Guide: https://packaging.python.org/ .. _packaging Python projects: https://packaging.python.org/en/latest/tutorials/pac...
python, official-docs, cpython, P0
Local_Trusted_Corpus
03b521cc-8450-4e72-98d4-7e96f86a0e25
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,049
supabase-export-v2
cd0b617808ab4077
python -m pip install SomePackage==1.0.4 # specific version python -m pip install "SomePackage>=1.0.4" # minimum version Normally, if a suitable module is already installed, attempting to install it again will have no effect. Upgrading existing modules must be requested explicitly::
trusted_official_docs
CPython Docs
python -m pip install SomePackage==1.0.4 # specific version python -m pip install "SomePackage>=1.0.4" # minimum version Normally, if a suitable module is already installed, attempting to install it again will have no effect. Upgrading existing modules must be requested explicitly::
python -m pip install SomePackage==1.0.4 # specific version python -m pip install "SomePackage>=1.0.4" # minimum version Normally, if a suitable module is already installed, attempting to install it again will have no effect. Upgrading existing modules must be requested explicitly::
python, official-docs, cpython, P0
Local_Trusted_Corpus
0ac5ad35-9c59-4ad6-a7e8-90d5995454ff
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,048
supabase-export-v2
61d24a2536528330
as ``>``, ``<`` or some other special character which get interpreted by shell, the package name and the version should be enclosed within double quotes:: python -m pip install SomePackage==1.0.4 # specific version python -m pip install "SomePackage>=1.0.4" # minimum version
trusted_official_docs
CPython Docs
as ``>``, ``<`` or some other special character which get interpreted by shell, the package name and the version should be enclosed within double quotes:: python -m pip install SomePackage==1.0.4 # specific version python -m pip install "SomePackage>=1.0.4" # minimum version
as ``>``, ``<`` or some other special character which get interpreted by shell, the package name and the version should be enclosed within double quotes:: python -m pip install SomePackage==1.0.4 # specific version python -m pip install "SomePackage>=1.0.4" # minimum version
python, official-docs, cpython, P0
Local_Trusted_Corpus
1f8dc115-4510-4608-a7a8-d1aabee881d7
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,038
supabase-export-v2
b6824e0742dc9821
the standard packaging tools and the associated metadata and file format standards. They maintain a variety of tools, documentation, and issue trackers on `GitHub <https://github.com/pypa>`__. .. versionchanged:: 3.5 The use of ``venv`` is now recommended for creating virtual environments.
trusted_official_docs
CPython Docs
the standard packaging tools and the associated metadata and file format standards. They maintain a variety of tools, documentation, and issue trackers on `GitHub <https://github.com/pypa>`__. .. versionchanged:: 3.5 The use of ``venv`` is now recommended for creating virtual environments.
the standard packaging tools and the associated metadata and file format standards. They maintain a variety of tools, documentation, and issue trackers on `GitHub <https://github.com/pypa>`__. .. versionchanged:: 3.5 The use of ``venv`` is now recommended for creating virtual environments.
python, official-docs, cpython, P0
Local_Trusted_Corpus
279a5d93-4228-48e0-a6de-c17c9a7c5ffd
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,066
supabase-export-v2
bb870124db53a4d5
On Linux, macOS, and other POSIX systems, use the versioned Python commands in combination with the ``-m`` switch to run the appropriate copy of :program:`pip`:: python3 -m pip install SomePackage # default Python 3 python3.14 -m pip install SomePackage # specifically Python 3.14
trusted_official_docs
CPython Docs
On Linux, macOS, and other POSIX systems, use the versioned Python commands in combination with the ``-m`` switch to run the appropriate copy of :program:`pip`:: python3 -m pip install SomePackage # default Python 3 python3.14 -m pip install SomePackage # specifically Python 3.14
On Linux, macOS, and other POSIX systems, use the versioned Python commands in combination with the ``-m`` switch to run the appropriate copy of :program:`pip`:: python3 -m pip install SomePackage # default Python 3 python3.14 -m pip install SomePackage # specifically Python 3.14
python, official-docs, cpython, P0
Local_Trusted_Corpus
2816521d-e53f-4b77-8b9f-cd20e2fe8030
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,036
supabase-export-v2
79a9bf0470199a7d
Key terms ========= * :program:`pip` is the preferred installer program. It is included by default with the Python binary installers. * A *virtual environment* is a semi-isolated Python environment that allows packages to be installed for use by a particular application, rather than being installed system wide. * ``...
trusted_official_docs
CPython Docs
Key terms ========= * :program:`pip` is the preferred installer program. It is included by default with the Python binary installers. * A *virtual environment* is a semi-isolated Python environment that allows packages to be installed for use by a particular application, rather than being installed system wide. * ``...
Key terms ========= * :program:`pip` is the preferred installer program. It is included by default with the Python binary installers. * A *virtual environment* is a semi-isolated Python environment that allows packages to be installed for use by a particular application, rather than being installed system wide. * ``...
python, official-docs, cpython, P0
Local_Trusted_Corpus
41a24e43-94d2-4994-864e-020e0341944c
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,050
supabase-export-v2
b1440c2fe36372c0
Normally, if a suitable module is already installed, attempting to install it again will have no effect. Upgrading existing modules must be requested explicitly:: python -m pip install --upgrade SomePackage
trusted_official_docs
CPython Docs
Normally, if a suitable module is already installed, attempting to install it again will have no effect. Upgrading existing modules must be requested explicitly:: python -m pip install --upgrade SomePackage
Normally, if a suitable module is already installed, attempting to install it again will have no effect. Upgrading existing modules must be requested explicitly:: python -m pip install --upgrade SomePackage
python, official-docs, cpython, P0
Local_Trusted_Corpus
54e5be50-af8b-40bf-a21f-a9d3bae5dabf
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,052
supabase-export-v2
bfd930c051604a08
More information and resources regarding :program:`pip` and its capabilities can be found in the `Python Packaging User Guide <https://packaging.python.org>`__. Creation of virtual environments is done through the :mod:`venv` module. Installing packages into an active virtual environment uses the commands shown above.
trusted_official_docs
CPython Docs
More information and resources regarding :program:`pip` and its capabilities can be found in the `Python Packaging User Guide <https://packaging.python.org>`__. Creation of virtual environments is done through the :mod:`venv` module. Installing packages into an active virtual environment uses the commands shown above.
More information and resources regarding :program:`pip` and its capabilities can be found in the `Python Packaging User Guide <https://packaging.python.org>`__. Creation of virtual environments is done through the :mod:`venv` module. Installing packages into an active virtual environment uses the commands shown above.
python, official-docs, cpython, P0
Local_Trusted_Corpus
5dc6a17a-5270-4898-afb7-6cc560e248c2
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,065
supabase-export-v2
33d5173db7c6042a
... work with multiple versions of Python installed in parallel? ---------------------------------------------------------------- On Linux, macOS, and other POSIX systems, use the versioned Python commands in combination with the ``-m`` switch to run the appropriate copy of :program:`pip`::
trusted_official_docs
CPython Docs
... work with multiple versions of Python installed in parallel? ---------------------------------------------------------------- On Linux, macOS, and other POSIX systems, use the versioned Python commands in combination with the ``-m`` switch to run the appropriate copy of :program:`pip`::
... work with multiple versions of Python installed in parallel? ---------------------------------------------------------------- On Linux, macOS, and other POSIX systems, use the versioned Python commands in combination with the ``-m`` switch to run the appropriate copy of :program:`pip`::
python, official-docs, cpython, P0
Local_Trusted_Corpus
5eb0f5af-548e-4d93-ba11-6b6cdca05a0c
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,046
supabase-export-v2
f610e27d780b2f08
For POSIX users (including macOS and Linux users), the examples in this guide assume the use of a :term:`virtual environment`. For Windows users, the examples in this guide assume that the option to adjust the system PATH environment variable was selected when installing Python.
trusted_official_docs
CPython Docs
For POSIX users (including macOS and Linux users), the examples in this guide assume the use of a :term:`virtual environment`. For Windows users, the examples in this guide assume that the option to adjust the system PATH environment variable was selected when installing Python.
For POSIX users (including macOS and Linux users), the examples in this guide assume the use of a :term:`virtual environment`. For Windows users, the examples in this guide assume that the option to adjust the system PATH environment variable was selected when installing Python.
python, official-docs, cpython, P0
Local_Trusted_Corpus
62ea31d4-5465-4527-94d4-73ffc3373f95
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,047
supabase-export-v2
cee733314a5d561f
For Windows users, the examples in this guide assume that the option to adjust the system PATH environment variable was selected when installing Python. It's also possible to specify an exact or minimum version directly on the command line. When using comparator operators such as ``>``, ``<`` or some other special char...
trusted_official_docs
CPython Docs
For Windows users, the examples in this guide assume that the option to adjust the system PATH environment variable was selected when installing Python. It's also possible to specify an exact or minimum version directly on the command line. When using comparator operators such as ``>``, ``<`` or some other special char...
For Windows users, the examples in this guide assume that the option to adjust the system PATH environment variable was selected when installing Python. It's also possible to specify an exact or minimum version directly on the command line. When using comparator operators such as ``>``, ``<`` or some other special char...
python, official-docs, cpython, P0
Local_Trusted_Corpus
766cc5e0-04c4-4f41-8faf-f4c6ce26fed0
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,060
supabase-export-v2
d8865b2e342d1688
the ``--user`` option to ``python -m pip install`` will install a package just for the current user, rather than for all users of the system. ... install scientific Python packages? ---------------------------------------
trusted_official_docs
CPython Docs
the ``--user`` option to ``python -m pip install`` will install a package just for the current user, rather than for all users of the system. ... install scientific Python packages? ---------------------------------------
the ``--user`` option to ``python -m pip install`` will install a package just for the current user, rather than for all users of the system. ... install scientific Python packages? ---------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
79735964-c546-4c28-8ae7-16e34979c612
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,069
supabase-export-v2
3c4833789897dc20
On Windows, use the :program:`py` Python launcher in combination with the ``-m`` switch:: py -3 -m pip install SomePackage # default Python 3 py -3.14 -m pip install SomePackage # specifically Python 3.14
trusted_official_docs
CPython Docs
On Windows, use the :program:`py` Python launcher in combination with the ``-m`` switch:: py -3 -m pip install SomePackage # default Python 3 py -3.14 -m pip install SomePackage # specifically Python 3.14
On Windows, use the :program:`py` Python launcher in combination with the ``-m`` switch:: py -3 -m pip install SomePackage # default Python 3 py -3.14 -m pip install SomePackage # specifically Python 3.14
python, official-docs, cpython, P0
Local_Trusted_Corpus
81669c25-4951-46c2-8e9c-03060c6ea2be
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,071
supabase-export-v2
9682654cb2fc507b
.. other questions: Once the Development & Deployment part of PPUG is fleshed out, some of those sections should be linked from new questions here (most notably, we should have a question about avoiding depending on PyPI that links to https://packaging.python.org/en/latest/guides/index-mirrors-and-caches/)
trusted_official_docs
CPython Docs
.. other questions: Once the Development & Deployment part of PPUG is fleshed out, some of those sections should be linked from new questions here (most notably, we should have a question about avoiding depending on PyPI that links to https://packaging.python.org/en/latest/guides/index-mirrors-and-caches/)
.. other questions: Once the Development & Deployment part of PPUG is fleshed out, some of those sections should be linked from new questions here (most notably, we should have a question about avoiding depending on PyPI that links to https://packaging.python.org/en/latest/guides/index-mirrors-and-caches/)
python, official-docs, cpython, P0
Local_Trusted_Corpus
878fa290-3a07-45a9-917c-4a21d8de2c20
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,032
supabase-export-v2
be5c956eec265e90
covers the installation part of the process. For a guide to creating and sharing your own Python projects, refer to the `Python packaging user guide`_. .. _Python Packaging User Guide: https://packaging.python.org/en/latest/tutorials/packaging-projects/
trusted_official_docs
CPython Docs
covers the installation part of the process. For a guide to creating and sharing your own Python projects, refer to the `Python packaging user guide`_. .. _Python Packaging User Guide: https://packaging.python.org/en/latest/tutorials/packaging-projects/
covers the installation part of the process. For a guide to creating and sharing your own Python projects, refer to 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
8a899917-1f07-4bf8-bf1f-3fc55946dd56
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,061
supabase-export-v2
fce35d2fe459006d
... install scientific Python packages? --------------------------------------- A number of scientific Python packages have complex binary dependencies, and aren't currently easy to install using :program:`pip` directly. It will often be easier for users to install these packages by `other means <https://packaging.pyth...
trusted_official_docs
CPython Docs
... install scientific Python packages? --------------------------------------- A number of scientific Python packages have complex binary dependencies, and aren't currently easy to install using :program:`pip` directly. It will often be easier for users to install these packages by `other means <https://packaging.pyth...
... install scientific Python packages? --------------------------------------- A number of scientific Python packages have complex binary dependencies, and aren't currently easy to install using :program:`pip` directly. It will often be easier for users to install these packages by `other means <https://packaging.pyth...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9a8e4ffd-b9e5-497d-a517-b041607c031e
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,083
supabase-export-v2
0724a40e5f28027a
publish wheels through PyPI, this problem is diminishing, as users are more regularly able to install pre-built extensions rather than needing to build them themselves. Some of the solutions for installing `scientific software <https://packaging.python.org/science/>`__ that are not yet available as pre-built wheel file...
trusted_official_docs
CPython Docs
publish wheels through PyPI, this problem is diminishing, as users are more regularly able to install pre-built extensions rather than needing to build them themselves. Some of the solutions for installing `scientific software <https://packaging.python.org/science/>`__ that are not yet available as pre-built wheel file...
publish wheels through PyPI, this problem is diminishing, as users are more regularly able to install pre-built extensions rather than needing to build them themselves. Some of the solutions for installing `scientific software <https://packaging.python.org/science/>`__ that are not yet available as pre-built wheel file...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9d9b958a-9886-44e3-a910-8f3e030ba298
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,031
supabase-export-v2
58e050735b6299a2
the solutions others have already created to common (and sometimes even rare!) problems, as well as potentially contributing their own solutions to the common pool. This guide covers the installation part of the process. For a guide to creating and sharing your own Python projects, refer to the `Python packaging user g...
trusted_official_docs
CPython Docs
the solutions others have already created to common (and sometimes even rare!) problems, as well as potentially contributing their own solutions to the common pool. This guide covers the installation part of the process. For a guide to creating and sharing your own Python projects, refer to the `Python packaging user g...
the solutions others have already created to common (and sometimes even rare!) problems, as well as potentially contributing their own solutions to the common pool. This guide covers the installation part of the process. For a guide to creating and sharing your own Python projects, refer to the `Python packaging user g...
python, official-docs, cpython, P0
Local_Trusted_Corpus
afd2bbc2-65f1-4de2-8ca5-c39924f3d071
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,034
supabase-export-v2
c004e0f259fb223f
.. note:: For corporate and other institutional users, be aware that many organisations have their own policies around using and contributing to open source software. Please take such policies into account when making use of the distribution and installation tools provided with Python.
trusted_official_docs
CPython Docs
.. note:: For corporate and other institutional users, be aware that many organisations have their own policies around using and contributing to open source software. Please take such policies into account when making use of the distribution and installation tools provided with Python.
.. note:: For corporate and other institutional users, be aware that many organisations have their own policies around using and contributing to open source software. Please take such policies into account when making use of the distribution and installation tools provided with Python.
python, official-docs, cpython, P0
Local_Trusted_Corpus
b542cfa7-1dce-4fe6-b02a-ad18e9f5bff8
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,082
supabase-export-v2
b5387bd0e2b9296d
Python once relied heavily on source-based distribution, with end users being expected to compile extension modules from source as part of the installation process. With the introduction of the binary wheel format, and the ability to publish wheels through PyPI, this problem is diminishing, as users are more regularly ...
trusted_official_docs
CPython Docs
Python once relied heavily on source-based distribution, with end users being expected to compile extension modules from source as part of the installation process. With the introduction of the binary wheel format, and the ability to publish wheels through PyPI, this problem is diminishing, as users are more regularly ...
Python once relied heavily on source-based distribution, with end users being expected to compile extension modules from source as part of the installation process. With the introduction of the binary wheel format, and the ability to publish wheels through PyPI, this problem is diminishing, as users are more regularly ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
bf583242-a95f-49af-aca7-00eb49d15652
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,059
supabase-export-v2
21c30721cbf21f56
... install packages just for the current user? ----------------------------------------------- Passing the ``--user`` option to ``python -m pip install`` will install a package just for the current user, rather than for all users of the system.
trusted_official_docs
CPython Docs
... install packages just for the current user? ----------------------------------------------- Passing the ``--user`` option to ``python -m pip install`` will install a package just for the current user, rather than for all users of the system.
... install packages just for the current user? ----------------------------------------------- Passing the ``--user`` option to ``python -m pip install`` will install a package just for the current user, rather than for all users of the system.
python, official-docs, cpython, P0
Local_Trusted_Corpus
caf7b4df-580b-40ae-ba57-20123cffa1b9
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,074
supabase-export-v2
138c49626c85b6ac
Installing into the system Python on Linux ------------------------------------------ On Linux systems, a Python installation will typically be included as part of the distribution. Installing into this Python installation requires root access to the system, and may interfere with the operation of the system package ma...
trusted_official_docs
CPython Docs
Installing into the system Python on Linux ------------------------------------------ On Linux systems, a Python installation will typically be included as part of the distribution. Installing into this Python installation requires root access to the system, and may interfere with the operation of the system package ma...
Installing into the system Python on Linux ------------------------------------------ On Linux systems, a Python installation will typically be included as part of the distribution. Installing into this Python installation requires root access to the system, and may interfere with the operation of the system package ma...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ccc0dc02-307f-48b1-8427-94b331a14ca4
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,043
supabase-export-v2
8aa8bdd0b127437f
The standard packaging tools are all designed to be used from the command line. The following command will install the latest version of a module and its dependencies from PyPI::
trusted_official_docs
CPython Docs
The standard packaging tools are all designed to be used from the command line. The following command will install the latest version of a module and its dependencies from PyPI::
The standard packaging tools are all designed to be used from the command line. The following command will install the latest version of a module and its dependencies from PyPI::
python, official-docs, cpython, P0
Local_Trusted_Corpus
d73c806a-10ea-4019-86e9-ef35f01eae03
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,029
supabase-export-v2
12e9f2a1ea837a0a
************************* Installing Python modules ************************* As a popular open source development project, Python has an active supporting community of contributors and users that also make their software available for other Python developers to use under open-source license terms.
trusted_official_docs
CPython Docs
************************* Installing Python modules ************************* As a popular open source development project, Python has an active supporting community of contributors and users that also make their software available for other Python developers to use under open-source license terms.
************************* Installing Python modules ************************* As a popular open source development project, Python has an active supporting community of contributors and users that also make their software available for other Python developers to use under open-source license terms.
python, official-docs, cpython, P0
Local_Trusted_Corpus
dac4cd4e-6398-456a-923e-ff2f26280301
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,037
supabase-export-v2
09ff75b1a759c89a
``venv``. * The `Python Package Index (PyPI) <https://pypi.org>`__ is a public repository of open source licensed packages made available for use by other Python users. * The `Python Packaging Authority <https://www.pypa.io/>`__ is the group of developers and documentation authors responsible for the maintenance and ...
trusted_official_docs
CPython Docs
``venv``. * The `Python Package Index (PyPI) <https://pypi.org>`__ is a public repository of open source licensed packages made available for use by other Python users. * The `Python Packaging Authority <https://www.pypa.io/>`__ is the group of developers and documentation authors responsible for the maintenance and ...
``venv``. * The `Python Package Index (PyPI) <https://pypi.org>`__ is a public repository of open source licensed packages made available for use by other Python users. * The `Python Packaging Authority <https://www.pypa.io/>`__ is the group of developers and documentation authors responsible for the maintenance and ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
fa0f5cce-b9aa-4768-9149-30bd0633b05a
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,030
supabase-export-v2
60c6560a079a5580
has an active supporting community of contributors and users that also make their software available for other Python developers to use under open-source license terms. This allows Python users to share and collaborate effectively, benefiting from the solutions others have already created to common (and sometimes even ...
trusted_official_docs
CPython Docs
has an active supporting community of contributors and users that also make their software available for other Python developers to use under open-source license terms. This allows Python users to share and collaborate effectively, benefiting from the solutions others have already created to common (and sometimes even ...
has an active supporting community of contributors and users that also make their software available for other Python developers to use under open-source license terms. This allows Python users to share and collaborate effectively, benefiting from the solutions others have already created to common (and sometimes even ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
fd5fce22-d355-4b91-a37f-aebb6dcc8119
CPython Docs
file://datasets/cpython/Doc/installing/index.rst
unknown
c0607314-beb3-4bd9-8721-35b64c75837f
56,075
supabase-export-v2
2f9a725ce4c211da
and may interfere with the operation of the system package manager and other components of the system if a component is unexpectedly upgraded using :program:`pip`. On such systems, it is often better to use a virtual environment or a per-user installation when installing packages with :program:`pip`.
trusted_official_docs
CPython Docs
and may interfere with the operation of the system package manager and other components of the system if a component is unexpectedly upgraded using :program:`pip`. On such systems, it is often better to use a virtual environment or a per-user installation when installing packages with :program:`pip`.
and may interfere with the operation of the system package manager and other components of the system if a component is unexpectedly upgraded using :program:`pip`. On such systems, it is often better to use a virtual environment or a per-user installation when installing packages with :program:`pip`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
128fd507-37c6-4149-b21a-d0afc3c5c53a
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,143
supabase-export-v2
be64ad088d0389f1
.. doctest:: >>> s = sorted(student_objects, key=attrgetter('age')) # sort on secondary key >>> sorted(s, key=attrgetter('grade'), reverse=True) # now sort on primary key, descending [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]
trusted_official_docs
CPython Docs
.. doctest:: >>> s = sorted(student_objects, key=attrgetter('age')) # sort on secondary key >>> sorted(s, key=attrgetter('grade'), reverse=True) # now sort on primary key, descending [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]
.. doctest:: >>> s = sorted(student_objects, key=attrgetter('age')) # sort on secondary key >>> sorted(s, key=attrgetter('grade'), reverse=True) # now sort on primary key, descending [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]
python, official-docs, cpython, P0
Local_Trusted_Corpus
16193f89-dcdb-4868-b07e-cb7e875e36e7
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,207
supabase-export-v2
d546ddeb55afd21c
a time. For values of *n* that are small relative to the number of inputs, these functions make far fewer comparisons than a full sort. * :func:`heapq.heappush` and :func:`heapq.heappop` create and maintain a partially sorted arrangement of data that keeps the smallest element at position ``0``. These functions are s...
trusted_official_docs
CPython Docs
a time. For values of *n* that are small relative to the number of inputs, these functions make far fewer comparisons than a full sort. * :func:`heapq.heappush` and :func:`heapq.heappop` create and maintain a partially sorted arrangement of data that keeps the smallest element at position ``0``. These functions are s...
a time. For values of *n* that are small relative to the number of inputs, these functions make far fewer comparisons than a full sort. * :func:`heapq.heappush` and :func:`heapq.heappop` create and maintain a partially sorted arrangement of data that keeps the smallest element at position ``0``. These functions are s...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1daa3ab1-13f4-4248-b827-16b7ceafa2eb
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,162
supabase-export-v2
4463b23befe5f3cc
Another name for this idiom is `Schwartzian transform <https://en.wikipedia.org/wiki/Schwartzian_transform>`_\, after Randal L. Schwartz, who popularized it among Perl programmers. Now that Python sorting provides key-functions, this technique is not often needed.
trusted_official_docs
CPython Docs
Another name for this idiom is `Schwartzian transform <https://en.wikipedia.org/wiki/Schwartzian_transform>`_\, after Randal L. Schwartz, who popularized it among Perl programmers. Now that Python sorting provides key-functions, this technique is not often needed.
Another name for this idiom is `Schwartzian transform <https://en.wikipedia.org/wiki/Schwartzian_transform>`_\, after Randal L. Schwartz, who popularized it among Perl programmers. Now that Python sorting provides key-functions, this technique is not often needed.
python, official-docs, cpython, P0
Local_Trusted_Corpus
1eed3ddd-11ab-4202-aa49-3d0df37ebbce
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,109
supabase-export-v2
375f7f00b2f4e320
12), ... ('dave', 'B', 10), ... ] >>> sorted(student_tuples, key=lambda student: student[2]) # sort by age [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] The same technique works for objects with named attributes. For example:
trusted_official_docs
CPython Docs
12), ... ('dave', 'B', 10), ... ] >>> sorted(student_tuples, key=lambda student: student[2]) # sort by age [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] The same technique works for objects with named attributes. For example:
12), ... ('dave', 'B', 10), ... ] >>> sorted(student_tuples, key=lambda student: student[2]) # sort by age [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] The same technique works for objects with named attributes. For example:
python, official-docs, cpython, P0
Local_Trusted_Corpus
2883970c-f0f5-4f27-9b06-0e0ae2516993
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,192
supabase-export-v2
7b591e5444f4516b
Odds and Ends ============= * For locale aware sorting, use :func:`locale.strxfrm` for a key function or :func:`locale.strcoll` for a comparison function. This is necessary because "alphabetical" sort orderings can vary across cultures even if the underlying alphabet is the same.
trusted_official_docs
CPython Docs
Odds and Ends ============= * For locale aware sorting, use :func:`locale.strxfrm` for a key function or :func:`locale.strcoll` for a comparison function. This is necessary because "alphabetical" sort orderings can vary across cultures even if the underlying alphabet is the same.
Odds and Ends ============= * For locale aware sorting, use :func:`locale.strxfrm` for a key function or :func:`locale.strcoll` for a comparison function. This is necessary because "alphabetical" sort orderings can vary across cultures even if the underlying alphabet is the same.
python, official-docs, cpython, P0
Local_Trusted_Corpus
2bee7e74-e8fa-4562-a718-65ab0135df73
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,111
supabase-export-v2
092df2da0bb59fe8
.. doctest:: >>> class Student: ... def __init__(self, name, grade, age): ... self.name = name ... self.grade = grade ... self.age = age ... def __repr__(self): ... return repr((self.name, self.grade, self.age))
trusted_official_docs
CPython Docs
.. doctest:: >>> class Student: ... def __init__(self, name, grade, age): ... self.name = name ... self.grade = grade ... self.age = age ... def __repr__(self): ... return repr((self.name, self.grade, self.age))
.. doctest:: >>> class Student: ... def __init__(self, name, grade, age): ... self.name = name ... self.grade = grade ... self.age = age ... def __repr__(self): ... return repr((self.name, self.grade, self.age))
python, official-docs, cpython, P0
Local_Trusted_Corpus
326ad1aa-0531-43a7-8d48-39f8b4247a8a
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,195
supabase-export-v2
5433df23fc4d4254
.. doctest:: >>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)] >>> standard_way = sorted(data, key=itemgetter(0), reverse=True) >>> double_reversed = list(reversed(sorted(reversed(data), key=itemgetter(0)))) >>> assert standard_way == double_reversed >>> standard_way [('red', 1), ('red', 2), ('blue', 1...
trusted_official_docs
CPython Docs
.. doctest:: >>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)] >>> standard_way = sorted(data, key=itemgetter(0), reverse=True) >>> double_reversed = list(reversed(sorted(reversed(data), key=itemgetter(0)))) >>> assert standard_way == double_reversed >>> standard_way [('red', 1), ('red', 2), ('blue', 1...
.. doctest:: >>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)] >>> standard_way = sorted(data, key=itemgetter(0), reverse=True) >>> double_reversed = list(reversed(sorted(reversed(data), key=itemgetter(0)))) >>> assert standard_way == double_reversed >>> standard_way [('red', 1), ('red', 2), ('blue', 1...
python, official-docs, cpython, P0
Local_Trusted_Corpus
35b8c644-cfbb-49cc-a17a-52c63fe29616
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,088
supabase-export-v2
ef6b2ae663b2f683
:Author: Andrew Dalke and Raymond Hettinger Python lists have a built-in :meth:`list.sort` method that modifies the list in-place. There is also a :func:`sorted` built-in function that builds a new sorted list from an iterable.
trusted_official_docs
CPython Docs
:Author: Andrew Dalke and Raymond Hettinger Python lists have a built-in :meth:`list.sort` method that modifies the list in-place. There is also a :func:`sorted` built-in function that builds a new sorted list from an iterable.
:Author: Andrew Dalke and Raymond Hettinger Python lists have a built-in :meth:`list.sort` method that modifies the list in-place. There is also a :func:`sorted` built-in function that builds a new sorted list from an iterable.
python, official-docs, cpython, P0
Local_Trusted_Corpus
382e32d3-5401-4a5a-a166-18bfc6c7f173
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,200
supabase-export-v2
f6c440c803920a95
on the mechanics). To avoid surprises, :pep:`8` recommends that all six comparison methods be implemented. The :func:`~functools.total_ordering` decorator is provided to make that task easier. * Key functions need not depend directly on the objects being sorted. A key function can also access external resources. For i...
trusted_official_docs
CPython Docs
on the mechanics). To avoid surprises, :pep:`8` recommends that all six comparison methods be implemented. The :func:`~functools.total_ordering` decorator is provided to make that task easier. * Key functions need not depend directly on the objects being sorted. A key function can also access external resources. For i...
on the mechanics). To avoid surprises, :pep:`8` recommends that all six comparison methods be implemented. The :func:`~functools.total_ordering` decorator is provided to make that task easier. * Key functions need not depend directly on the objects being sorted. A key function can also access external resources. For i...
python, official-docs, cpython, P0
Local_Trusted_Corpus
43409f9c-d13f-46b6-aef5-ff9cb8b94ecc
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,161
supabase-export-v2
7fca092f380dcab8
will be determined by at most the first two items. So for example the original list could contain complex numbers which cannot be sorted directly. Another name for this idiom is `Schwartzian transform <https://en.wikipedia.org/wiki/Schwartzian_transform>`_\, after Randal L. Schwartz, who popularized it among Perl progr...
trusted_official_docs
CPython Docs
will be determined by at most the first two items. So for example the original list could contain complex numbers which cannot be sorted directly. Another name for this idiom is `Schwartzian transform <https://en.wikipedia.org/wiki/Schwartzian_transform>`_\, after Randal L. Schwartz, who popularized it among Perl progr...
will be determined by at most the first two items. So for example the original list could contain complex numbers which cannot be sorted directly. Another name for this idiom is `Schwartzian transform <https://en.wikipedia.org/wiki/Schwartzian_transform>`_\, after Randal L. Schwartz, who popularized it among Perl progr...
python, official-docs, cpython, P0
Local_Trusted_Corpus
489ea3ce-507a-4f26-b953-4bc23585a088
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,106
supabase-export-v2
02ca2489da71676c
and returns a key to use for sorting purposes. This technique is fast because the key function is called exactly once for each input record. A common pattern is to sort complex objects using some of the object's indices as keys. For example:
trusted_official_docs
CPython Docs
and returns a key to use for sorting purposes. This technique is fast because the key function is called exactly once for each input record. A common pattern is to sort complex objects using some of the object's indices as keys. For example:
and returns a key to use for sorting purposes. This technique is fast because the key function is called exactly once for each input record. A common pattern is to sort complex objects using some of the object's indices as keys. For example:
python, official-docs, cpython, P0
Local_Trusted_Corpus
491db5cb-093f-40ef-8176-042d6d19f3af
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,102
supabase-export-v2
3de41d03a1fd4c49
:func:`heapq.nsmallest`, and :func:`heapq.nlargest` have a *key* parameter to specify a function (or other callable) to be called on each list element prior to making comparisons. For example, here's a case-insensitive string comparison using :meth:`str.casefold`:
trusted_official_docs
CPython Docs
:func:`heapq.nsmallest`, and :func:`heapq.nlargest` have a *key* parameter to specify a function (or other callable) to be called on each list element prior to making comparisons. For example, here's a case-insensitive string comparison using :meth:`str.casefold`:
:func:`heapq.nsmallest`, and :func:`heapq.nlargest` have a *key* parameter to specify a function (or other callable) to be called on each list element prior to making comparisons. For example, here's a case-insensitive string comparison using :meth:`str.casefold`:
python, official-docs, cpython, P0
Local_Trusted_Corpus
49a9b721-7208-4caf-9b2f-8783dde972a3
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,199
supabase-export-v2
840787d6dccf6ee8
>>> Student.__lt__ = lambda self, other: self.age < other.age >>> sorted(student_objects) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] However, note that ``<`` can fall back to using :meth:`~object.__gt__` if :meth:`~object.__lt__` is not implemented (see :func:`object.__lt__` for details on the mechanic...
trusted_official_docs
CPython Docs
>>> Student.__lt__ = lambda self, other: self.age < other.age >>> sorted(student_objects) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] However, note that ``<`` can fall back to using :meth:`~object.__gt__` if :meth:`~object.__lt__` is not implemented (see :func:`object.__lt__` for details on the mechanic...
>>> Student.__lt__ = lambda self, other: self.age < other.age >>> sorted(student_objects) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] However, note that ``<`` can fall back to using :meth:`~object.__gt__` if :meth:`~object.__lt__` is not implemented (see :func:`object.__lt__` for details on the mechanic...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4a0698f2-4dfe-478a-accd-356dbbab4090
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,140
supabase-export-v2
a7ffd5450ac2af00
>>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)] >>> sorted(data, key=itemgetter(0)) [('blue', 1), ('blue', 2), ('red', 1), ('red', 2)] Notice how the two records for *blue* retain their original order so that ``('blue', 1)`` is guaranteed to precede ``('blue', 2)``.
trusted_official_docs
CPython Docs
>>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)] >>> sorted(data, key=itemgetter(0)) [('blue', 1), ('blue', 2), ('red', 1), ('red', 2)] Notice how the two records for *blue* retain their original order so that ``('blue', 1)`` is guaranteed to precede ``('blue', 2)``.
>>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)] >>> sorted(data, key=itemgetter(0)) [('blue', 1), ('blue', 2), ('red', 1), ('red', 2)] Notice how the two records for *blue* retain their original order so that ``('blue', 1)`` is guaranteed to precede ``('blue', 2)``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
4b2a4223-a884-4970-ab13-728791e26617
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,157
supabase-export-v2
b194f4fa46ebe9f9
i, student in enumerate(student_objects)] >>> decorated.sort() >>> [student for grade, i, student in decorated] # undecorate [('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)] This idiom works because tuples are compared lexicographically; the first items are compared; if they are the same then the second items ...
trusted_official_docs
CPython Docs
i, student in enumerate(student_objects)] >>> decorated.sort() >>> [student for grade, i, student in decorated] # undecorate [('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)] This idiom works because tuples are compared lexicographically; the first items are compared; if they are the same then the second items ...
i, student in enumerate(student_objects)] >>> decorated.sort() >>> [student for grade, i, student in decorated] # undecorate [('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)] This idiom works because tuples are compared lexicographically; the first items are compared; if they are the same then the second items ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4d1c365e-d1c2-43ca-bd58-5bafe62390cd
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,108
supabase-export-v2
20b85979a69e9f15
.. doctest:: >>> student_tuples = [ ... ('john', 'A', 15), ... ('jane', 'B', 12), ... ('dave', 'B', 10), ... ] >>> sorted(student_tuples, key=lambda student: student[2]) # sort by age [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]
trusted_official_docs
CPython Docs
.. doctest:: >>> student_tuples = [ ... ('john', 'A', 15), ... ('jane', 'B', 12), ... ('dave', 'B', 10), ... ] >>> sorted(student_tuples, key=lambda student: student[2]) # sort by age [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]
.. doctest:: >>> student_tuples = [ ... ('john', 'A', 15), ... ('jane', 'B', 12), ... ('dave', 'B', 10), ... ] >>> sorted(student_tuples, key=lambda student: student[2]) # sort by age [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]
python, official-docs, cpython, P0
Local_Trusted_Corpus
4de5292c-fc85-4763-9764-1b9b36447404
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,205
supabase-export-v2
2fab02ec224357eb
Some applications require only some of the data to be ordered. The standard library provides several tools that do less work than a full sort: * :func:`min` and :func:`max` return the smallest and largest values, respectively. These functions make a single pass over the input data and require almost no auxiliary memo...
trusted_official_docs
CPython Docs
Some applications require only some of the data to be ordered. The standard library provides several tools that do less work than a full sort: * :func:`min` and :func:`max` return the smallest and largest values, respectively. These functions make a single pass over the input data and require almost no auxiliary memo...
Some applications require only some of the data to be ordered. The standard library provides several tools that do less work than a full sort: * :func:`min` and :func:`max` return the smallest and largest values, respectively. These functions make a single pass over the input data and require almost no auxiliary memo...
python, official-docs, cpython, P0
Local_Trusted_Corpus
581bb658-73e6-493a-ad64-69529fee174e
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,147
supabase-export-v2
caf56e297d8662f6
>>> def multisort(xs, specs): ... for key, reverse in reversed(specs): ... xs.sort(key=attrgetter(key), reverse=reverse) ... return xs >>> multisort(list(student_objects), (('grade', True), ('age', False))) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]
trusted_official_docs
CPython Docs
>>> def multisort(xs, specs): ... for key, reverse in reversed(specs): ... xs.sort(key=attrgetter(key), reverse=reverse) ... return xs >>> multisort(list(student_objects), (('grade', True), ('age', False))) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]
>>> def multisort(xs, specs): ... for key, reverse in reversed(specs): ... xs.sort(key=attrgetter(key), reverse=reverse) ... return xs >>> multisort(list(student_objects), (('grade', True), ('age', False))) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]
python, official-docs, cpython, P0
Local_Trusted_Corpus
5a3ff848-b751-43be-9928-ed9566f0d7cd
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,141
supabase-export-v2
335020b9128f21af
Notice how the two records for *blue* retain their original order so that ``('blue', 1)`` is guaranteed to precede ``('blue', 2)``. This wonderful property lets you build complex sorts in a series of sorting steps. For example, to sort the student data by descending *grade* and then ascending *age*, do the *age* sort f...
trusted_official_docs
CPython Docs
Notice how the two records for *blue* retain their original order so that ``('blue', 1)`` is guaranteed to precede ``('blue', 2)``. This wonderful property lets you build complex sorts in a series of sorting steps. For example, to sort the student data by descending *grade* and then ascending *age*, do the *age* sort f...
Notice how the two records for *blue* retain their original order so that ``('blue', 1)`` is guaranteed to precede ``('blue', 2)``. This wonderful property lets you build complex sorts in a series of sorting steps. For example, to sort the student data by descending *grade* and then ascending *age*, do the *age* sort f...
python, official-docs, cpython, P0
Local_Trusted_Corpus
5a7019ab-bdf5-432a-9524-83985ba59fd0
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,116
supabase-export-v2
69c0dd827abbd6e9
are very common, so Python provides convenience functions to make accessor functions easier and faster. The :mod:`operator` module has :func:`~operator.itemgetter`, :func:`~operator.attrgetter`, and a :func:`~operator.methodcaller` function. Using those functions, the above examples become simpler and faster:
trusted_official_docs
CPython Docs
are very common, so Python provides convenience functions to make accessor functions easier and faster. The :mod:`operator` module has :func:`~operator.itemgetter`, :func:`~operator.attrgetter`, and a :func:`~operator.methodcaller` function. Using those functions, the above examples become simpler and faster:
are very common, so Python provides convenience functions to make accessor functions easier and faster. The :mod:`operator` module has :func:`~operator.itemgetter`, :func:`~operator.attrgetter`, and a :func:`~operator.methodcaller` function. Using those functions, the above examples become simpler and faster:
python, official-docs, cpython, P0
Local_Trusted_Corpus
5e2e9d8b-cee4-4d92-8075-b8ccaee50b7d
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,148
supabase-export-v2
c759b506c61b4800
>>> multisort(list(student_objects), (('grade', True), ('age', False))) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] The `Timsort <https://en.wikipedia.org/wiki/Timsort>`_ algorithm used in Python does multiple sorts efficiently because it can take advantage of any ordering already present in a dataset.
trusted_official_docs
CPython Docs
>>> multisort(list(student_objects), (('grade', True), ('age', False))) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] The `Timsort <https://en.wikipedia.org/wiki/Timsort>`_ algorithm used in Python does multiple sorts efficiently because it can take advantage of any ordering already present in a dataset.
>>> multisort(list(student_objects), (('grade', True), ('age', False))) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] The `Timsort <https://en.wikipedia.org/wiki/Timsort>`_ algorithm used in Python does multiple sorts efficiently because it can take advantage of any ordering already present in a dataset.
python, official-docs, cpython, P0
Local_Trusted_Corpus
63716e89-2074-446d-82e6-2ac865f095b8
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,206
supabase-export-v2
a7787340b088c36c
and :func:`max` return the smallest and largest values, respectively. These functions make a single pass over the input data and require almost no auxiliary memory. * :func:`heapq.nsmallest` and :func:`heapq.nlargest` return the *n* smallest and largest values, respectively. These functions make a single pass over th...
trusted_official_docs
CPython Docs
and :func:`max` return the smallest and largest values, respectively. These functions make a single pass over the input data and require almost no auxiliary memory. * :func:`heapq.nsmallest` and :func:`heapq.nlargest` return the *n* smallest and largest values, respectively. These functions make a single pass over th...
and :func:`max` return the smallest and largest values, respectively. These functions make a single pass over the input data and require almost no auxiliary memory. * :func:`heapq.nsmallest` and :func:`heapq.nlargest` return the *n* smallest and largest values, respectively. These functions make a single pass over th...
python, official-docs, cpython, P0
Local_Trusted_Corpus
673318ad-74c3-4385-a93b-d58d432afa93
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,094
supabase-export-v2
e7c2f76952dd0c47
>>> sorted([5, 2, 3, 1, 4]) [1, 2, 3, 4, 5] You can also use the :meth:`list.sort` method. It modifies the list in-place (and returns ``None`` to avoid confusion). Usually it's less convenient than :func:`sorted` - but if you don't need the original list, it's slightly more efficient.
trusted_official_docs
CPython Docs
>>> sorted([5, 2, 3, 1, 4]) [1, 2, 3, 4, 5] You can also use the :meth:`list.sort` method. It modifies the list in-place (and returns ``None`` to avoid confusion). Usually it's less convenient than :func:`sorted` - but if you don't need the original list, it's slightly more efficient.
>>> sorted([5, 2, 3, 1, 4]) [1, 2, 3, 4, 5] You can also use the :meth:`list.sort` method. It modifies the list in-place (and returns ``None`` to avoid confusion). Usually it's less convenient than :func:`sorted` - but if you don't need the original list, it's slightly more efficient.
python, official-docs, cpython, P0
Local_Trusted_Corpus
6fab960c-5eb9-4961-b936-87523190df12
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,089
supabase-export-v2
d909a26ab158570e
a built-in :meth:`list.sort` method that modifies the list in-place. There is also a :func:`sorted` built-in function that builds a new sorted list from an iterable. In this document, we explore the various techniques for sorting data using Python.
trusted_official_docs
CPython Docs
a built-in :meth:`list.sort` method that modifies the list in-place. There is also a :func:`sorted` built-in function that builds a new sorted list from an iterable. In this document, we explore the various techniques for sorting data using Python.
a built-in :meth:`list.sort` method that modifies the list in-place. There is also a :func:`sorted` built-in function that builds a new sorted list from an iterable. In this document, we explore the various techniques for sorting data using Python.
python, official-docs, cpython, P0
Local_Trusted_Corpus
71e98bc1-8878-4a72-abac-fc39da351ca6
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,193
supabase-export-v2
cb5adcdf796dc0b8
or :func:`locale.strcoll` for a comparison function. This is necessary because "alphabetical" sort orderings can vary across cultures even if the underlying alphabet is the same. * The *reverse* parameter still maintains sort stability (so that records with equal keys retain the original order). Interestingly, that ef...
trusted_official_docs
CPython Docs
or :func:`locale.strcoll` for a comparison function. This is necessary because "alphabetical" sort orderings can vary across cultures even if the underlying alphabet is the same. * The *reverse* parameter still maintains sort stability (so that records with equal keys retain the original order). Interestingly, that ef...
or :func:`locale.strcoll` for a comparison function. This is necessary because "alphabetical" sort orderings can vary across cultures even if the underlying alphabet is the same. * The *reverse* parameter still maintains sort stability (so that records with equal keys retain the original order). Interestingly, that ef...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7bda8528-c5d5-44e3-9cce-6a47418c9fc9
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,115
supabase-export-v2
931e6a8d8f55b3f4
Operator Module Functions and Partial Function Evaluation ========================================================= The :term:`key function` patterns shown above are very common, so Python provides convenience functions to make accessor functions easier and faster. The :mod:`operator` module has :func:`~operator.itemge...
trusted_official_docs
CPython Docs
Operator Module Functions and Partial Function Evaluation ========================================================= The :term:`key function` patterns shown above are very common, so Python provides convenience functions to make accessor functions easier and faster. The :mod:`operator` module has :func:`~operator.itemge...
Operator Module Functions and Partial Function Evaluation ========================================================= The :term:`key function` patterns shown above are very common, so Python provides convenience functions to make accessor functions easier and faster. The :mod:`operator` module has :func:`~operator.itemge...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7f873aaa-852d-42d0-a9fd-edd07383d77a
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,160
supabase-export-v2
6ab75e7d7923a9d1
* The sort is stable -- if two items have the same key, their order will be preserved in the sorted list. * The original items do not have to be comparable because the ordering of the decorated tuples will be determined by at most the first two items. So for example the original list could contain complex numbers whi...
trusted_official_docs
CPython Docs
* The sort is stable -- if two items have the same key, their order will be preserved in the sorted list. * The original items do not have to be comparable because the ordering of the decorated tuples will be determined by at most the first two items. So for example the original list could contain complex numbers whi...
* The sort is stable -- if two items have the same key, their order will be preserved in the sorted list. * The original items do not have to be comparable because the ordering of the decorated tuples will be determined by at most the first two items. So for example the original list could contain complex numbers whi...
python, official-docs, cpython, P0
Local_Trusted_Corpus
83007ef5-ec67-4389-aeb7-b49b51d6fba4
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,114
supabase-export-v2
12e0466ffa8edac7
Objects with named attributes can be made by a regular class as shown above, or they can be instances of :class:`~dataclasses.dataclass` or a :term:`named tuple`. Operator Module Functions and Partial Function Evaluation =========================================================
trusted_official_docs
CPython Docs
Objects with named attributes can be made by a regular class as shown above, or they can be instances of :class:`~dataclasses.dataclass` or a :term:`named tuple`. Operator Module Functions and Partial Function Evaluation =========================================================
Objects with named attributes can be made by a regular class as shown above, or they can be instances of :class:`~dataclasses.dataclass` or a :term:`named tuple`. Operator Module Functions and Partial Function Evaluation =========================================================
python, official-docs, cpython, P0
Local_Trusted_Corpus
9490b7b6-2e1c-4f1d-af43-00551db34053
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,154
supabase-export-v2
73240ef0be1e6708
* Finally, the decorations are removed, creating a list that contains only the initial values in the new order. For example, to sort the student data by *grade* using the DSU approach:
trusted_official_docs
CPython Docs
* Finally, the decorations are removed, creating a list that contains only the initial values in the new order. For example, to sort the student data by *grade* using the DSU approach:
* Finally, the decorations are removed, creating a list that contains only the initial values in the new order. For example, to sort the student data by *grade* using the DSU approach:
python, official-docs, cpython, P0
Local_Trusted_Corpus
953f2611-351e-43b6-8aaf-b2eb5331cda2
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,156
supabase-export-v2
adda85a00121ba23
.. doctest:: >>> decorated = [(student.grade, i, student) for i, student in enumerate(student_objects)] >>> decorated.sort() >>> [student for grade, i, student in decorated] # undecorate [('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]
trusted_official_docs
CPython Docs
.. doctest:: >>> decorated = [(student.grade, i, student) for i, student in enumerate(student_objects)] >>> decorated.sort() >>> [student for grade, i, student in decorated] # undecorate [('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]
.. doctest:: >>> decorated = [(student.grade, i, student) for i, student in enumerate(student_objects)] >>> decorated.sort() >>> [student for grade, i, student in decorated] # undecorate [('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]
python, official-docs, cpython, P0
Local_Trusted_Corpus
9631c39e-3932-4265-bdba-6c425e4418cf
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,182
supabase-export-v2
e6d25d5178d02939
>>> data = [3.3, None, 1.1, 2.2] >>> sorted(x for x in data if x is not None) [1.1, 2.2, 3.3] This is needed because ``None`` is not comparable to other types.
trusted_official_docs
CPython Docs
>>> data = [3.3, None, 1.1, 2.2] >>> sorted(x for x in data if x is not None) [1.1, 2.2, 3.3] This is needed because ``None`` is not comparable to other types.
>>> data = [3.3, None, 1.1, 2.2] >>> sorted(x for x in data if x is not None) [1.1, 2.2, 3.3] This is needed because ``None`` is not comparable to other types.
python, official-docs, cpython, P0
Local_Trusted_Corpus
a31e1e54-1deb-4b7b-bf93-2413f502015c
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,166
supabase-export-v2
3039feac52969edb
comparison function such as ``cmp(a, b)`` will return a negative value for less-than, zero if the inputs are equal, or a positive value for greater-than. It is common to encounter comparison functions when translating algorithms from other languages. Also, some libraries provide comparison functions as part of their AP...
trusted_official_docs
CPython Docs
comparison function such as ``cmp(a, b)`` will return a negative value for less-than, zero if the inputs are equal, or a positive value for greater-than. It is common to encounter comparison functions when translating algorithms from other languages. Also, some libraries provide comparison functions as part of their AP...
comparison function such as ``cmp(a, b)`` will return a negative value for less-than, zero if the inputs are equal, or a positive value for greater-than. It is common to encounter comparison functions when translating algorithms from other languages. Also, some libraries provide comparison functions as part of their AP...
python, official-docs, cpython, P0
Local_Trusted_Corpus
aa23eccd-3a78-400a-867a-4d93fe5fe622
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,121
supabase-export-v2
2d2ff1b6992ceac8
>>> sorted(student_objects, key=attrgetter('age')) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] The operator module functions allow multiple levels of sorting. For example, to sort by *grade* then by *age*:
trusted_official_docs
CPython Docs
>>> sorted(student_objects, key=attrgetter('age')) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] The operator module functions allow multiple levels of sorting. For example, to sort by *grade* then by *age*:
>>> sorted(student_objects, key=attrgetter('age')) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] The operator module functions allow multiple levels of sorting. For example, to sort by *grade* then by *age*:
python, official-docs, cpython, P0
Local_Trusted_Corpus
beb1cd8d-ac47-4ef2-9ce5-c5c46146a4b3
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,101
supabase-export-v2
774ca3d08ca16e61
Key Functions ============= The :meth:`list.sort` method and the functions :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nsmallest`, and :func:`heapq.nlargest` have a *key* parameter to specify a function (or other callable) to be called on each list element prior to making comparisons.
trusted_official_docs
CPython Docs
Key Functions ============= The :meth:`list.sort` method and the functions :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nsmallest`, and :func:`heapq.nlargest` have a *key* parameter to specify a function (or other callable) to be called on each list element prior to making comparisons.
Key Functions ============= The :meth:`list.sort` method and the functions :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nsmallest`, and :func:`heapq.nlargest` have a *key* parameter to specify a function (or other callable) to be called on each list element prior to making comparisons.
python, official-docs, cpython, P0
Local_Trusted_Corpus
c423829c-3c1b-4522-9e46-27c22eded594
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,178
supabase-export-v2
e240a154d6ddefdf
>>> from math import isnan >>> from itertools import filterfalse >>> data = [3.3, float('nan'), 1.1, 2.2] >>> sorted(filterfalse(isnan, data)) [1.1, 2.2, 3.3] This is needed because the `IEEE-754 standard <https://en.wikipedia.org/wiki/IEEE_754>`_ specifies that, "Every NaN shall compare unordered with everything, incl...
trusted_official_docs
CPython Docs
>>> from math import isnan >>> from itertools import filterfalse >>> data = [3.3, float('nan'), 1.1, 2.2] >>> sorted(filterfalse(isnan, data)) [1.1, 2.2, 3.3] This is needed because the `IEEE-754 standard <https://en.wikipedia.org/wiki/IEEE_754>`_ specifies that, "Every NaN shall compare unordered with everything, incl...
>>> from math import isnan >>> from itertools import filterfalse >>> data = [3.3, float('nan'), 1.1, 2.2] >>> sorted(filterfalse(isnan, data)) [1.1, 2.2, 3.3] This is needed because the `IEEE-754 standard <https://en.wikipedia.org/wiki/IEEE_754>`_ specifies that, "Every NaN shall compare unordered with everything, incl...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c4d6c135-eda8-451f-9dad-df901a236c0f
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,196
supabase-export-v2
89c047a8364625d3
standard_way = sorted(data, key=itemgetter(0), reverse=True) >>> double_reversed = list(reversed(sorted(reversed(data), key=itemgetter(0)))) >>> assert standard_way == double_reversed >>> standard_way [('red', 1), ('red', 2), ('blue', 1), ('blue', 2)] * The sort routines use ``<`` when making comparisons between two o...
trusted_official_docs
CPython Docs
standard_way = sorted(data, key=itemgetter(0), reverse=True) >>> double_reversed = list(reversed(sorted(reversed(data), key=itemgetter(0)))) >>> assert standard_way == double_reversed >>> standard_way [('red', 1), ('red', 2), ('blue', 1), ('blue', 2)] * The sort routines use ``<`` when making comparisons between two o...
standard_way = sorted(data, key=itemgetter(0), reverse=True) >>> double_reversed = list(reversed(sorted(reversed(data), key=itemgetter(0)))) >>> assert standard_way == double_reversed >>> standard_way [('red', 1), ('red', 2), ('blue', 1), ('blue', 2)] * The sort routines use ``<`` when making comparisons between two o...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c68e282e-1253-4300-ab65-1b1095d5aeed
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,125
supabase-export-v2
3c84e0ad5963e363
>>> sorted(student_objects, key=attrgetter('grade', 'age')) [('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)] The :mod:`functools` module provides another helpful tool for making key-functions. The :func:`~functools.partial` function can reduce the `arity <https://en.wikipedia.org/wiki/Arity>`_ of a multi-argum...
trusted_official_docs
CPython Docs
>>> sorted(student_objects, key=attrgetter('grade', 'age')) [('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)] The :mod:`functools` module provides another helpful tool for making key-functions. The :func:`~functools.partial` function can reduce the `arity <https://en.wikipedia.org/wiki/Arity>`_ of a multi-argum...
>>> sorted(student_objects, key=attrgetter('grade', 'age')) [('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)] The :mod:`functools` module provides another helpful tool for making key-functions. The :func:`~functools.partial` function can reduce the `arity <https://en.wikipedia.org/wiki/Arity>`_ of a multi-argum...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c90f5985-098b-4afc-bcfa-2ca9cd438f1c
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,144
supabase-export-v2
efeb05b4cbd92009
# sort on secondary key >>> sorted(s, key=attrgetter('grade'), reverse=True) # now sort on primary key, descending [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] This can be abstracted out into a wrapper function that can take a list and tuples of field and order to sort them on multiple passes.
trusted_official_docs
CPython Docs
# sort on secondary key >>> sorted(s, key=attrgetter('grade'), reverse=True) # now sort on primary key, descending [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] This can be abstracted out into a wrapper function that can take a list and tuples of field and order to sort them on multiple passes.
# sort on secondary key >>> sorted(s, key=attrgetter('grade'), reverse=True) # now sort on primary key, descending [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] This can be abstracted out into a wrapper function that can take a list and tuples of field and order to sort them on multiple passes.
python, official-docs, cpython, P0
Local_Trusted_Corpus
ce59a039-efd0-4a64-9d43-ecf5e70d2d00
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,190
supabase-export-v2
4a1c492273d41c90
>>> data = [{'a', 'b', 'c'}, {'b', 'c', 'd'}] >>> sorted(map(sorted, data)) [['a', 'b', 'c'], ['b', 'c', 'd']] This is needed because the elements contained in set types do not have a deterministic order. For example, ``list({'a', 'b'})`` may produce either ``['a', 'b']`` or ``['b', 'a']``.
trusted_official_docs
CPython Docs
>>> data = [{'a', 'b', 'c'}, {'b', 'c', 'd'}] >>> sorted(map(sorted, data)) [['a', 'b', 'c'], ['b', 'c', 'd']] This is needed because the elements contained in set types do not have a deterministic order. For example, ``list({'a', 'b'})`` may produce either ``['a', 'b']`` or ``['b', 'a']``.
>>> data = [{'a', 'b', 'c'}, {'b', 'c', 'd'}] >>> sorted(map(sorted, data)) [['a', 'b', 'c'], ['b', 'c', 'd']] This is needed because the elements contained in set types do not have a deterministic order. For example, ``list({'a', 'b'})`` may produce either ``['a', 'b']`` or ``['b', 'a']``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
d127d16b-ab56-4160-96d3-b0a45f7d276a
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,165
supabase-export-v2
2e586c55c8efc392
Unlike key functions that return an absolute value for sorting, a comparison function computes the relative ordering for two inputs. For example, a `balance scale <https://upload.wikimedia.org/wikipedia/commons/1/17/Balance_à_tabac_1850.JPG>`_ compares two samples giving a relative ordering: lighter, equal, or heavier....
trusted_official_docs
CPython Docs
Unlike key functions that return an absolute value for sorting, a comparison function computes the relative ordering for two inputs. For example, a `balance scale <https://upload.wikimedia.org/wikipedia/commons/1/17/Balance_à_tabac_1850.JPG>`_ compares two samples giving a relative ordering: lighter, equal, or heavier....
Unlike key functions that return an absolute value for sorting, a comparison function computes the relative ordering for two inputs. For example, a `balance scale <https://upload.wikimedia.org/wikipedia/commons/1/17/Balance_à_tabac_1850.JPG>`_ compares two samples giving a relative ordering: lighter, equal, or heavier....
python, official-docs, cpython, P0
Local_Trusted_Corpus
dce8f9d5-b5c1-47a4-9a8b-96ab2278fb43
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,105
supabase-export-v2
94854eee1b9b8483
>>> sorted("This is a test string from Andrew".split(), key=str.casefold) ['a', 'Andrew', 'from', 'is', 'string', 'test', 'This'] The value of the *key* parameter should be a function (or other callable) that takes a single argument and returns a key to use for sorting purposes. This technique is fast because the key f...
trusted_official_docs
CPython Docs
>>> sorted("This is a test string from Andrew".split(), key=str.casefold) ['a', 'Andrew', 'from', 'is', 'string', 'test', 'This'] The value of the *key* parameter should be a function (or other callable) that takes a single argument and returns a key to use for sorting purposes. This technique is fast because the key f...
>>> sorted("This is a test string from Andrew".split(), key=str.casefold) ['a', 'Andrew', 'from', 'is', 'string', 'test', 'This'] The value of the *key* parameter should be a function (or other callable) that takes a single argument and returns a key to use for sorting purposes. This technique is fast because the key f...
python, official-docs, cpython, P0
Local_Trusted_Corpus
df1eee1e-35d7-4a42-85a0-85a755b9b3df
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,112
supabase-export-v2
1403bacfdd84be3e
def __init__(self, name, grade, age): ... self.name = name ... self.grade = grade ... self.age = age ... def __repr__(self): ... return repr((self.name, self.grade, self.age)) >>> student_objects = [ ... Student('john', 'A', 15), ... Student('jane', 'B', 12), ... Student('dave', 'B', 10), ... ] >>> sorted(student_...
trusted_official_docs
CPython Docs
def __init__(self, name, grade, age): ... self.name = name ... self.grade = grade ... self.age = age ... def __repr__(self): ... return repr((self.name, self.grade, self.age)) >>> student_objects = [ ... Student('john', 'A', 15), ... Student('jane', 'B', 12), ... Student('dave', 'B', 10), ... ] >>> sorted(student_...
def __init__(self, name, grade, age): ... self.name = name ... self.grade = grade ... self.age = age ... def __repr__(self): ... return repr((self.name, self.grade, self.age)) >>> student_objects = [ ... Student('john', 'A', 15), ... Student('jane', 'B', 12), ... Student('dave', 'B', 10), ... ] >>> sorted(student_...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e1854cb9-2b29-41a2-993e-9c9dec876935
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,113
supabase-export-v2
d8bb64eccca4e3ad
12), ... Student('dave', 'B', 10), ... ] >>> sorted(student_objects, key=lambda student: student.age) # sort by age [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] Objects with named attributes can be made by a regular class as shown above, or they can be instances of :class:`~dataclasses.dataclass` or a :ter...
trusted_official_docs
CPython Docs
12), ... Student('dave', 'B', 10), ... ] >>> sorted(student_objects, key=lambda student: student.age) # sort by age [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] Objects with named attributes can be made by a regular class as shown above, or they can be instances of :class:`~dataclasses.dataclass` or a :ter...
12), ... Student('dave', 'B', 10), ... ] >>> sorted(student_objects, key=lambda student: student.age) # sort by age [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] Objects with named attributes can be made by a regular class as shown above, or they can be instances of :class:`~dataclasses.dataclass` or a :ter...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e2453a43-dcaf-4b0a-8d06-50cf893858e6
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,159
supabase-export-v2
8dc1e1723c031c20
It is not strictly necessary in all cases to include the index *i* in the decorated list, but including it gives two benefits: * The sort is stable -- if two items have the same key, their order will be preserved in the sorted list.
trusted_official_docs
CPython Docs
It is not strictly necessary in all cases to include the index *i* in the decorated list, but including it gives two benefits: * The sort is stable -- if two items have the same key, their order will be preserved in the sorted list.
It is not strictly necessary in all cases to include the index *i* in the decorated list, but including it gives two benefits: * The sort is stable -- if two items have the same key, their order will be preserved in the sorted list.
python, official-docs, cpython, P0
Local_Trusted_Corpus
e677b5ad-9279-47b4-b2b3-ea58fb72cba7
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,167
supabase-export-v2
85fc608cfe69538f
functions when translating algorithms from other languages. Also, some libraries provide comparison functions as part of their API. For example, :func:`locale.strcoll` is a comparison function. To accommodate those situations, Python provides :class:`functools.cmp_to_key` to wrap the comparison function to make it usab...
trusted_official_docs
CPython Docs
functions when translating algorithms from other languages. Also, some libraries provide comparison functions as part of their API. For example, :func:`locale.strcoll` is a comparison function. To accommodate those situations, Python provides :class:`functools.cmp_to_key` to wrap the comparison function to make it usab...
functions when translating algorithms from other languages. Also, some libraries provide comparison functions as part of their API. For example, :func:`locale.strcoll` is a comparison function. To accommodate those situations, Python provides :class:`functools.cmp_to_key` to wrap the comparison function to make it usab...
python, official-docs, cpython, P0
Local_Trusted_Corpus
eeb63076-6651-4c18-abb1-e9bb56ebcba9
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,097
supabase-export-v2
aac237492c01e9e1
>>> a = [5, 2, 3, 1, 4] >>> a.sort() >>> a [1, 2, 3, 4, 5] Another difference is that the :meth:`list.sort` method is only defined for lists. In contrast, the :func:`sorted` function accepts any iterable.
trusted_official_docs
CPython Docs
>>> a = [5, 2, 3, 1, 4] >>> a.sort() >>> a [1, 2, 3, 4, 5] Another difference is that the :meth:`list.sort` method is only defined for lists. In contrast, the :func:`sorted` function accepts any iterable.
>>> a = [5, 2, 3, 1, 4] >>> a.sort() >>> a [1, 2, 3, 4, 5] Another difference is that the :meth:`list.sort` method is only defined for lists. In contrast, the :func:`sorted` function accepts any iterable.
python, official-docs, cpython, P0
Local_Trusted_Corpus
ef4d0dfe-fd6a-4c7f-9391-7a7b6671262e
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,158
supabase-export-v2
08bdfb1f35e86e51
works because tuples are compared lexicographically; the first items are compared; if they are the same then the second items are compared, and so on. It is not strictly necessary in all cases to include the index *i* in the decorated list, but including it gives two benefits:
trusted_official_docs
CPython Docs
works because tuples are compared lexicographically; the first items are compared; if they are the same then the second items are compared, and so on. It is not strictly necessary in all cases to include the index *i* in the decorated list, but including it gives two benefits:
works because tuples are compared lexicographically; the first items are compared; if they are the same then the second items are compared, and so on. It is not strictly necessary in all cases to include the index *i* in the decorated list, but including it gives two benefits:
python, official-docs, cpython, P0
Local_Trusted_Corpus
ef508f29-b54c-435a-96ae-ee543cc1860d
CPython Docs
file://datasets/cpython/Doc/howto/sorting.rst
unknown
737ab78a-0c54-43e8-8481-6df41a376716
56,132
supabase-export-v2
26ee36d1add8691e
Ascending and Descending ======================== Both :meth:`list.sort` and :func:`sorted` accept a *reverse* parameter with a boolean value. This is used to flag descending sorts. For example, to get the student data in reverse *age* order:
trusted_official_docs
CPython Docs
Ascending and Descending ======================== Both :meth:`list.sort` and :func:`sorted` accept a *reverse* parameter with a boolean value. This is used to flag descending sorts. For example, to get the student data in reverse *age* order:
Ascending and Descending ======================== Both :meth:`list.sort` and :func:`sorted` accept a *reverse* parameter with a boolean value. This is used to flag descending sorts. For example, to get the student data in reverse *age* order:
python, official-docs, cpython, P0
Local_Trusted_Corpus
017e7324-7fcf-4b6e-885c-f580bc5c2183
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,334
supabase-export-v2
bac9965c57eadfd2
slen = struct.unpack('>L', chunk)[0] chunk = self.connection.recv(slen) while len(chunk) < slen: chunk = chunk + self.connection.recv(slen - len(chunk)) obj = self.unPickle(chunk) record = logging.makeLogRecord(obj) self.handleLogRecord(record) def unPickle(self, data): return pickle.loads(data)
trusted_official_docs
CPython Docs
slen = struct.unpack('>L', chunk)[0] chunk = self.connection.recv(slen) while len(chunk) < slen: chunk = chunk + self.connection.recv(slen - len(chunk)) obj = self.unPickle(chunk) record = logging.makeLogRecord(obj) self.handleLogRecord(record) def unPickle(self, data): return pickle.loads(data)
slen = struct.unpack('>L', chunk)[0] chunk = self.connection.recv(slen) while len(chunk) < slen: chunk = chunk + self.connection.recv(slen - len(chunk)) obj = self.unPickle(chunk) record = logging.makeLogRecord(obj) self.handleLogRecord(record) def unPickle(self, data): return pickle.loads(data)
python, official-docs, cpython, P0
Local_Trusted_Corpus
01a25e31-397d-403d-bd1c-2df919efc1ac
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,537
supabase-export-v2
24277d3495509764
import zmq # using pyzmq, the Python binding for ZeroMQ import json # for serializing records portably ctx = zmq.Context() sock = zmq.Socket(ctx, zmq.PUB) # or zmq.PUSH, or other suitable value sock.bind('tcp://*:5556') # or wherever
trusted_official_docs
CPython Docs
import zmq # using pyzmq, the Python binding for ZeroMQ import json # for serializing records portably ctx = zmq.Context() sock = zmq.Socket(ctx, zmq.PUB) # or zmq.PUSH, or other suitable value sock.bind('tcp://*:5556') # or wherever
import zmq # using pyzmq, the Python binding for ZeroMQ import json # for serializing records portably ctx = zmq.Context() sock = zmq.Socket(ctx, zmq.PUB) # or zmq.PUSH, or other suitable value sock.bind('tcp://*:5556') # or wherever
python, official-docs, cpython, P0
Local_Trusted_Corpus
02e1e904-c0c6-4d24-86e2-083999ad0886
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,955
supabase-export-v2
e5de5d2f441b860d
often static class attributes. However, this pattern doesn't make sense in Python, where the module (and not the class) is the unit of software decomposition. Adding handlers other than :class:`~logging.NullHandler` to a logger in a library ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
trusted_official_docs
CPython Docs
often static class attributes. However, this pattern doesn't make sense in Python, where the module (and not the class) is the unit of software decomposition. Adding handlers other than :class:`~logging.NullHandler` to a logger in a library ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
often static class attributes. However, this pattern doesn't make sense in Python, where the module (and not the class) is the unit of software decomposition. Adding handlers other than :class:`~logging.NullHandler` to a logger in a library ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
python, official-docs, cpython, P0
Local_Trusted_Corpus
02e74d78-a8c9-4118-a6e6-feaf7a5d69df
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,357
supabase-export-v2
5d337fdc759cc049
#. Run ``venv/bin/python client.py`` to exercise the web application, which will lead to records being written to the log. #. Inspect the log files in the :file:`run` subdirectory. You should see the most recent log lines in files matching the pattern :file:`app.log*`. They won't be in any particular order, since the...
trusted_official_docs
CPython Docs
#. Run ``venv/bin/python client.py`` to exercise the web application, which will lead to records being written to the log. #. Inspect the log files in the :file:`run` subdirectory. You should see the most recent log lines in files matching the pattern :file:`app.log*`. They won't be in any particular order, since the...
#. Run ``venv/bin/python client.py`` to exercise the web application, which will lead to records being written to the log. #. Inspect the log files in the :file:`run` subdirectory. You should see the most recent log lines in files matching the pattern :file:`app.log*`. They won't be in any particular order, since the...
python, official-docs, cpython, P0
Local_Trusted_Corpus
037a5f7a-1983-42a7-9bdc-285a57740bac
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,937
supabase-export-v2
6adc488708ad2573
h.setFormatter(EscapingFormatter('%(asctime)s %(levelname)-9s %(message)s')) logging.basicConfig(level=logging.DEBUG, handlers = [h]) logger.debug('Single line') logger.debug('Multiple lines:\nfool me once ...') logger.debug('Another single line') logger.debug('Multiple lines:\n%s', 'fool me ...\ncan\'t get fooled agai...
trusted_official_docs
CPython Docs
h.setFormatter(EscapingFormatter('%(asctime)s %(levelname)-9s %(message)s')) logging.basicConfig(level=logging.DEBUG, handlers = [h]) logger.debug('Single line') logger.debug('Multiple lines:\nfool me once ...') logger.debug('Another single line') logger.debug('Multiple lines:\n%s', 'fool me ...\ncan\'t get fooled agai...
h.setFormatter(EscapingFormatter('%(asctime)s %(levelname)-9s %(message)s')) logging.basicConfig(level=logging.DEBUG, handlers = [h]) logger.debug('Single line') logger.debug('Multiple lines:\nfool me once ...') logger.debug('Another single line') logger.debug('Multiple lines:\n%s', 'fool me ...\ncan\'t get fooled agai...
python, official-docs, cpython, P0
Local_Trusted_Corpus
03e89dc8-fe7b-4c8f-a64c-46c36bd53e73
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,427
supabase-export-v2
94f17b3238c2dcc8
153 ~/logging-contextual-webapp$ grep app2 app2.log | wc -l 147 ~/logging-contextual-webapp$ grep app1 app.log | wc -l 153 ~/logging-contextual-webapp$ grep app2 app.log | wc -l 147 Imparting contextual information in handlers --------------------------------------------
trusted_official_docs
CPython Docs
153 ~/logging-contextual-webapp$ grep app2 app2.log | wc -l 147 ~/logging-contextual-webapp$ grep app1 app.log | wc -l 153 ~/logging-contextual-webapp$ grep app2 app.log | wc -l 147 Imparting contextual information in handlers --------------------------------------------
153 ~/logging-contextual-webapp$ grep app2 app2.log | wc -l 147 ~/logging-contextual-webapp$ grep app1 app.log | wc -l 153 ~/logging-contextual-webapp$ grep app2 app.log | wc -l 147 Imparting contextual information in handlers --------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
04d527f0-2d91-4610-a641-da0e0110fbcf
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,747
supabase-export-v2
0dfed050a9bb9973
def write_line(s): sys.stderr.write('%s\n' % s) def foo(fail=False): write_line('about to log at DEBUG ...') logger.debug('Actually logged at DEBUG') write_line('about to log at INFO ...') logger.info('Actually logged at INFO') write_line('about to log at WARNING ...') logger.warning('Actually logged at WARNING')...
trusted_official_docs
CPython Docs
def write_line(s): sys.stderr.write('%s\n' % s) def foo(fail=False): write_line('about to log at DEBUG ...') logger.debug('Actually logged at DEBUG') write_line('about to log at INFO ...') logger.info('Actually logged at INFO') write_line('about to log at WARNING ...') logger.warning('Actually logged at WARNING')...
def write_line(s): sys.stderr.write('%s\n' % s) def foo(fail=False): write_line('about to log at DEBUG ...') logger.debug('Actually logged at DEBUG') write_line('about to log at INFO ...') logger.info('Actually logged at INFO') write_line('about to log at WARNING ...') logger.warning('Actually logged at WARNING')...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0542c1e0-7c5e-4ec0-b69a-d20d15385cb3
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,246
supabase-export-v2
00db4505712d0d2d
console use formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') # tell the handler to use this format console.setFormatter(formatter) # add the handler to the root logger logging.getLogger().addHandler(console) # Now, we can log to the root logger, or any other logger. First the root... logging.in...
trusted_official_docs
CPython Docs
console use formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') # tell the handler to use this format console.setFormatter(formatter) # add the handler to the root logger logging.getLogger().addHandler(console) # Now, we can log to the root logger, or any other logger. First the root... logging.in...
console use formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') # tell the handler to use this format console.setFormatter(formatter) # add the handler to the root logger logging.getLogger().addHandler(console) # Now, we can log to the root logger, or any other logger. First the root... logging.in...
python, official-docs, cpython, P0
Local_Trusted_Corpus
056141a3-bbd7-4dc8-821a-4d0366523364
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,850
supabase-export-v2
c000a8309bcd6b30
The handler # doesn't know or care about specific UI elements. # class QtHandler(logging.Handler): def __init__(self, slotfunc, *args, **kwargs): super().__init__(*args, **kwargs) self.signaller = Signaller() self.signaller.signal.connect(slotfunc) def emit(self, record): s = self.format(record) self.signaller.signal...
trusted_official_docs
CPython Docs
The handler # doesn't know or care about specific UI elements. # class QtHandler(logging.Handler): def __init__(self, slotfunc, *args, **kwargs): super().__init__(*args, **kwargs) self.signaller = Signaller() self.signaller.signal.connect(slotfunc) def emit(self, record): s = self.format(record) self.signaller.signal...
The handler # doesn't know or care about specific UI elements. # class QtHandler(logging.Handler): def __init__(self, slotfunc, *args, **kwargs): super().__init__(*args, **kwargs) self.signaller = Signaller() self.signaller.signal.connect(slotfunc) def emit(self, record): s = self.format(record) self.signaller.signal...
python, official-docs, cpython, P0
Local_Trusted_Corpus
063c6474-8035-4cce-b4af-1422bd6bcfbe
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,618
supabase-export-v2
7053c78eaacb3885
Inserting a BOM into messages sent to a SysLogHandler ----------------------------------------------------- :rfc:`5424` requires that a Unicode message be sent to a syslog daemon as a set of bytes which have the following structure: an optional pure-ASCII component, followed by a UTF-8 Byte Order Mark (BOM), followed b...
trusted_official_docs
CPython Docs
Inserting a BOM into messages sent to a SysLogHandler ----------------------------------------------------- :rfc:`5424` requires that a Unicode message be sent to a syslog daemon as a set of bytes which have the following structure: an optional pure-ASCII component, followed by a UTF-8 Byte Order Mark (BOM), followed b...
Inserting a BOM into messages sent to a SysLogHandler ----------------------------------------------------- :rfc:`5424` requires that a Unicode message be sent to a syslog daemon as a set of bytes which have the following structure: an optional pure-ASCII component, followed by a UTF-8 Byte Order Mark (BOM), followed b...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0643e0d4-e9ce-4308-b5b1-56078ce7900d
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,716
supabase-export-v2
a15db0cb1382b467
def format(self, record): s = super().format(record) if record.exc_text: s = s.replace('\n', '') + '|' return s def configure_logging(): fh = logging.FileHandler('output.txt', 'w') f = OneLineExceptionFormatter('%(asctime)s|%(levelname)s|%(message)s|', '%d/%m/%Y %H:%M:%S') fh.setFormatter(f) root = logging.getLogg...
trusted_official_docs
CPython Docs
def format(self, record): s = super().format(record) if record.exc_text: s = s.replace('\n', '') + '|' return s def configure_logging(): fh = logging.FileHandler('output.txt', 'w') f = OneLineExceptionFormatter('%(asctime)s|%(levelname)s|%(message)s|', '%d/%m/%Y %H:%M:%S') fh.setFormatter(f) root = logging.getLogg...
def format(self, record): s = super().format(record) if record.exc_text: s = s.replace('\n', '') + '|' return s def configure_logging(): fh = logging.FileHandler('output.txt', 'w') f = OneLineExceptionFormatter('%(asctime)s|%(levelname)s|%(message)s|', '%d/%m/%Y %H:%M:%S') fh.setFormatter(f) root = logging.getLogg...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0659bd88-5220-4b9b-a9d3-d0aba23e9cf2
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,656
supabase-export-v2
5ea597f1dda78d76
You can then specify, in a logging configuration passed to :func:`dictConfig`, that a logging handler be created by calling this function:: LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'default': { 'format': '%(asctime)s %(levelname)s %(name)s %(message)s' }, }, 'handlers': { 'f...
trusted_official_docs
CPython Docs
You can then specify, in a logging configuration passed to :func:`dictConfig`, that a logging handler be created by calling this function:: LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'default': { 'format': '%(asctime)s %(levelname)s %(name)s %(message)s' }, }, 'handlers': { 'f...
You can then specify, in a logging configuration passed to :func:`dictConfig`, that a logging handler be created by calling this function:: LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'default': { 'format': '%(asctime)s %(levelname)s %(name)s %(message)s' }, }, 'handlers': { 'f...
python, official-docs, cpython, P0
Local_Trusted_Corpus
081aa2a7-a727-4482-8b0a-ef2803818954
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,493
supabase-export-v2
f99541be37b94a20
messages for final output to logs is completely independent of how an individual logging message is constructed. That can still use %-formatting, as shown here:: >>> logger.error('This is an%s %s %s', 'other,', 'ERROR,', 'message') 2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message >>>
trusted_official_docs
CPython Docs
messages for final output to logs is completely independent of how an individual logging message is constructed. That can still use %-formatting, as shown here:: >>> logger.error('This is an%s %s %s', 'other,', 'ERROR,', 'message') 2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message >>>
messages for final output to logs is completely independent of how an individual logging message is constructed. That can still use %-formatting, as shown here:: >>> logger.error('This is an%s %s %s', 'other,', 'ERROR,', 'message') 2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message >>>
python, official-docs, cpython, P0
Local_Trusted_Corpus
08b68d85-bde7-45e1-babc-a3cb94efd5a6
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,620
supabase-export-v2
e5e505e9c3640dfe
it was implemented incorrectly, with the BOM appearing at the beginning of the message and hence not allowing any pure-ASCII component to appear before it. As this behaviour is broken, the incorrect BOM insertion code is being removed from Python 3.2.4 and later. However, it is not being replaced, and if you want to pr...
trusted_official_docs
CPython Docs
it was implemented incorrectly, with the BOM appearing at the beginning of the message and hence not allowing any pure-ASCII component to appear before it. As this behaviour is broken, the incorrect BOM insertion code is being removed from Python 3.2.4 and later. However, it is not being replaced, and if you want to pr...
it was implemented incorrectly, with the BOM appearing at the beginning of the message and hence not allowing any pure-ASCII component to appear before it. As this behaviour is broken, the incorrect BOM insertion code is being removed from Python 3.2.4 and later. However, it is not being replaced, and if you want to pr...
python, official-docs, cpython, P0
Local_Trusted_Corpus
08b7d73d-f521-4bff-8837-0121cc59d6ad
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,612
supabase-export-v2
81e42b2544830b47
logger used in the # parent process. This is needed on POSIX because the logger will # be there in the child following a fork(). config_worker = { 'version': 1, 'disable_existing_loggers': True, 'handlers': { 'queue': { 'class': 'logging.handlers.QueueHandler', 'queue': q } }, 'root': { 'handlers': ['queue'],...
trusted_official_docs
CPython Docs
logger used in the # parent process. This is needed on POSIX because the logger will # be there in the child following a fork(). config_worker = { 'version': 1, 'disable_existing_loggers': True, 'handlers': { 'queue': { 'class': 'logging.handlers.QueueHandler', 'queue': q } }, 'root': { 'handlers': ['queue'],...
logger used in the # parent process. This is needed on POSIX because the logger will # be there in the child following a fork(). config_worker = { 'version': 1, 'disable_existing_loggers': True, 'handlers': { 'queue': { 'class': 'logging.handlers.QueueHandler', 'queue': q } }, 'root': { 'handlers': ['queue'],...
python, official-docs, cpython, P0
Local_Trusted_Corpus