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
a452b47f-4fc2-4a15-b2f0-0512b1058cd5
CPython Docs
file://datasets/cpython/Doc/library/timeit.rst
unknown
6f2dbd94-9a6e-4670-a512-3aa511f095fc
16,674
supabase-export-v2
ef7a1ebc867b76e8
.. method:: Timer.timeit(number=1000000) Time *number* executions of the main statement. This executes the setup statement once, and then returns the time it takes to execute the main statement a number of times. The default timer returns seconds as a float. The argument is the number of times through the loop, defau...
trusted_official_docs
CPython Docs
.. method:: Timer.timeit(number=1000000) Time *number* executions of the main statement. This executes the setup statement once, and then returns the time it takes to execute the main statement a number of times. The default timer returns seconds as a float. The argument is the number of times through the loop, defau...
.. method:: Timer.timeit(number=1000000) Time *number* executions of the main statement. This executes the setup statement once, and then returns the time it takes to execute the main statement a number of times. The default timer returns seconds as a float. The argument is the number of times through the loop, defau...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a9af9d1b-2bbe-4a63-a8e9-74eda82ea109
CPython Docs
file://datasets/cpython/Doc/library/timeit.rst
unknown
6f2dbd94-9a6e-4670-a512-3aa511f095fc
16,729
supabase-export-v2
6c50e4d0ebfd8d2f
>>> import timeit >>> timeit.timeit('char in text', setup='text = "sample string"; char = "g"') 0.41440500499993504 >>> timeit.timeit('text.find(char)', setup='text = "sample string"; char = "g"') 1.7246671520006203 The same can be done using the :class:`Timer` class and its methods::
trusted_official_docs
CPython Docs
>>> import timeit >>> timeit.timeit('char in text', setup='text = "sample string"; char = "g"') 0.41440500499993504 >>> timeit.timeit('text.find(char)', setup='text = "sample string"; char = "g"') 1.7246671520006203 The same can be done using the :class:`Timer` class and its methods::
>>> import timeit >>> timeit.timeit('char in text', setup='text = "sample string"; char = "g"') 0.41440500499993504 >>> timeit.timeit('text.find(char)', setup='text = "sample string"; char = "g"') 1.7246671520006203 The same can be done using the :class:`Timer` class and its methods::
python, official-docs, cpython, P0
Local_Trusted_Corpus
b4168d18-6e77-4c16-bd00-3fcb1176c50b
CPython Docs
file://datasets/cpython/Doc/library/timeit.rst
unknown
6f2dbd94-9a6e-4670-a512-3aa511f095fc
16,686
supabase-export-v2
292251cbb7689af5
Call :meth:`.timeit` a few times. This is a convenience function that calls the :meth:`.timeit` repeatedly, returning a list of results. The first argument specifies how many times to call :meth:`.timeit`. The second argument specifies the *number* argument for :meth:`.timeit`.
trusted_official_docs
CPython Docs
Call :meth:`.timeit` a few times. This is a convenience function that calls the :meth:`.timeit` repeatedly, returning a list of results. The first argument specifies how many times to call :meth:`.timeit`. The second argument specifies the *number* argument for :meth:`.timeit`.
Call :meth:`.timeit` a few times. This is a convenience function that calls the :meth:`.timeit` repeatedly, returning a list of results. The first argument specifies how many times to call :meth:`.timeit`. The second argument specifies the *number* argument for :meth:`.timeit`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
b76a37fa-5fc2-4ea4-91c4-e578372199d3
CPython Docs
file://datasets/cpython/Doc/library/timeit.rst
unknown
6f2dbd94-9a6e-4670-a512-3aa511f095fc
16,657
supabase-export-v2
73075d5cea49e810
.. function:: timeit(stmt='pass', setup='pass', timer=<default timer>, number=1000000, globals=None) Create a :class:`Timer` instance with the given statement, *setup* code and *timer* function and run its :meth:`.timeit` method with *number* executions. The optional *globals* argument specifies a namespace in which t...
trusted_official_docs
CPython Docs
.. function:: timeit(stmt='pass', setup='pass', timer=<default timer>, number=1000000, globals=None) Create a :class:`Timer` instance with the given statement, *setup* code and *timer* function and run its :meth:`.timeit` method with *number* executions. The optional *globals* argument specifies a namespace in which t...
.. function:: timeit(stmt='pass', setup='pass', timer=<default timer>, number=1000000, globals=None) Create a :class:`Timer` instance with the given statement, *setup* code and *timer* function and run its :meth:`.timeit` method with *number* executions. The optional *globals* argument specifies a namespace in which t...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b87bdc60-2058-455a-b99f-326361839c4a
CPython Docs
file://datasets/cpython/Doc/library/timeit.rst
unknown
6f2dbd94-9a6e-4670-a512-3aa511f095fc
16,740
supabase-export-v2
3010e00ce95cb6d1
if __name__ == '__main__': import timeit print(timeit.timeit("test()", setup="from __main__ import test")) Another option is to pass :func:`globals` to the *globals* parameter, which will cause the code to be executed within your current global namespace. This can be more convenient than individually specifying imports...
trusted_official_docs
CPython Docs
if __name__ == '__main__': import timeit print(timeit.timeit("test()", setup="from __main__ import test")) Another option is to pass :func:`globals` to the *globals* parameter, which will cause the code to be executed within your current global namespace. This can be more convenient than individually specifying imports...
if __name__ == '__main__': import timeit print(timeit.timeit("test()", setup="from __main__ import test")) Another option is to pass :func:`globals` to the *globals* parameter, which will cause the code to be executed within your current global namespace. This can be more convenient than individually specifying imports...
python, official-docs, cpython, P0
Local_Trusted_Corpus
bf780fca-303a-4a33-95a4-2fce430edb31
CPython Docs
file://datasets/cpython/Doc/library/timeit.rst
unknown
6f2dbd94-9a6e-4670-a512-3aa511f095fc
16,671
supabase-export-v2
31a80db53e3e03d0
The execution time of *setup* is excluded from the overall timed execution run. The *stmt* and *setup* parameters can also take objects that are callable without arguments. This will embed calls to them in a timer function that will then be executed by :meth:`.timeit`. Note that the timing overhead is a little large...
trusted_official_docs
CPython Docs
The execution time of *setup* is excluded from the overall timed execution run. The *stmt* and *setup* parameters can also take objects that are callable without arguments. This will embed calls to them in a timer function that will then be executed by :meth:`.timeit`. Note that the timing overhead is a little large...
The execution time of *setup* is excluded from the overall timed execution run. The *stmt* and *setup* parameters can also take objects that are callable without arguments. This will embed calls to them in a timer function that will then be executed by :meth:`.timeit`. Note that the timing overhead is a little large...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c5944429-9dc6-42d8-907f-037201820385
CPython Docs
file://datasets/cpython/Doc/library/timeit.rst
unknown
6f2dbd94-9a6e-4670-a512-3aa511f095fc
16,733
supabase-export-v2
22e270bec5f27739
.. code-block:: shell-session $ python -m timeit "try:" " str.__bool__" "except AttributeError:" " pass" 20000 loops, best of 5: 15.7 usec per loop $ python -m timeit "if hasattr(str, '__bool__'): pass" 50000 loops, best of 5: 4.26 usec per loop
trusted_official_docs
CPython Docs
.. code-block:: shell-session $ python -m timeit "try:" " str.__bool__" "except AttributeError:" " pass" 20000 loops, best of 5: 15.7 usec per loop $ python -m timeit "if hasattr(str, '__bool__'): pass" 50000 loops, best of 5: 4.26 usec per loop
.. code-block:: shell-session $ python -m timeit "try:" " str.__bool__" "except AttributeError:" " pass" 20000 loops, best of 5: 15.7 usec per loop $ python -m timeit "if hasattr(str, '__bool__'): pass" 50000 loops, best of 5: 4.26 usec per loop
python, official-docs, cpython, P0
Local_Trusted_Corpus
c5c786a2-4347-429b-99d9-ad766e0e6dee
CPython Docs
file://datasets/cpython/Doc/library/timeit.rst
unknown
6f2dbd94-9a6e-4670-a512-3aa511f095fc
16,719
supabase-export-v2
a978d085cbb2b313
by trying increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the total time is at least :option:`--target-time` seconds (default: 0.2). :func:`default_timer` measurements can be affected by other programs running on the same machine, so the best thing to do when accurate timing is necessary is to repea...
trusted_official_docs
CPython Docs
by trying increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the total time is at least :option:`--target-time` seconds (default: 0.2). :func:`default_timer` measurements can be affected by other programs running on the same machine, so the best thing to do when accurate timing is necessary is to repea...
by trying increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the total time is at least :option:`--target-time` seconds (default: 0.2). :func:`default_timer` measurements can be affected by other programs running on the same machine, so the best thing to do when accurate timing is necessary is to repea...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ddb9a904-4ce7-4c4d-9f51-0438f6220675
CPython Docs
file://datasets/cpython/Doc/library/timeit.rst
unknown
6f2dbd94-9a6e-4670-a512-3aa511f095fc
16,661
supabase-export-v2
6f0c18d552dd6577
run its :meth:`.repeat` method with the given *repeat* count and *number* executions. The optional *globals* argument specifies a namespace in which to execute the code. .. versionchanged:: 3.5 The optional *globals* parameter was added.
trusted_official_docs
CPython Docs
run its :meth:`.repeat` method with the given *repeat* count and *number* executions. The optional *globals* argument specifies a namespace in which to execute the code. .. versionchanged:: 3.5 The optional *globals* parameter was added.
run its :meth:`.repeat` method with the given *repeat* count and *number* executions. The optional *globals* argument specifies a namespace in which to execute the code. .. versionchanged:: 3.5 The optional *globals* parameter was added.
python, official-docs, cpython, P0
Local_Trusted_Corpus
de2b4108-b826-4dae-8835-db2f285fc045
CPython Docs
file://datasets/cpython/Doc/library/timeit.rst
unknown
6f2dbd94-9a6e-4670-a512-3aa511f095fc
16,649
supabase-export-v2
0063df4347ba6a70
This can be achieved from the :ref:`python-interface` with:: >>> import timeit >>> timeit.timeit('"-".join(str(n) for n in range(100))', number=10000) 0.3018611848820001 >>> timeit.timeit('"-".join([str(n) for n in range(100)])', number=10000) 0.2727368790656328 >>> timeit.timeit('"-".join(map(str, range(100)))', ...
trusted_official_docs
CPython Docs
This can be achieved from the :ref:`python-interface` with:: >>> import timeit >>> timeit.timeit('"-".join(str(n) for n in range(100))', number=10000) 0.3018611848820001 >>> timeit.timeit('"-".join([str(n) for n in range(100)])', number=10000) 0.2727368790656328 >>> timeit.timeit('"-".join(map(str, range(100)))', ...
This can be achieved from the :ref:`python-interface` with:: >>> import timeit >>> timeit.timeit('"-".join(str(n) for n in range(100))', number=10000) 0.3018611848820001 >>> timeit.timeit('"-".join([str(n) for n in range(100)])', number=10000) 0.2727368790656328 >>> timeit.timeit('"-".join(map(str, range(100)))', ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e318c9a6-2bcf-4fc0-890a-369b36682e66
CPython Docs
file://datasets/cpython/Doc/library/timeit.rst
unknown
6f2dbd94-9a6e-4670-a512-3aa511f095fc
16,668
supabase-export-v2
a0cdb5b930e222f4
Class for timing execution speed of small code snippets. The constructor takes a statement to be timed, an additional statement used for setup, and a timer function. Both statements default to ``'pass'``; the timer function is platform-dependent (see the module doc string). *stmt* and *setup* may also contain multipl...
trusted_official_docs
CPython Docs
Class for timing execution speed of small code snippets. The constructor takes a statement to be timed, an additional statement used for setup, and a timer function. Both statements default to ``'pass'``; the timer function is platform-dependent (see the module doc string). *stmt* and *setup* may also contain multipl...
Class for timing execution speed of small code snippets. The constructor takes a statement to be timed, an additional statement used for setup, and a timer function. Both statements default to ``'pass'``; the timer function is platform-dependent (see the module doc string). *stmt* and *setup* may also contain multipl...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e830fab6-73f5-4173-87fd-a556bbfe0763
CPython Docs
file://datasets/cpython/Doc/library/timeit.rst
unknown
6f2dbd94-9a6e-4670-a512-3aa511f095fc
16,688
supabase-export-v2
eee5717abc7152fd
.. note:: It's tempting to calculate mean and standard deviation from the result vector and report these. However, this is not very useful. In a typical case, the lowest value gives a lower bound for how fast your machine can run the given code snippet; higher values in the result vector are typically not caused by ...
trusted_official_docs
CPython Docs
.. note:: It's tempting to calculate mean and standard deviation from the result vector and report these. However, this is not very useful. In a typical case, the lowest value gives a lower bound for how fast your machine can run the given code snippet; higher values in the result vector are typically not caused by ...
.. note:: It's tempting to calculate mean and standard deviation from the result vector and report these. However, this is not very useful. In a typical case, the lowest value gives a lower bound for how fast your machine can run the given code snippet; higher values in the result vector are typically not caused by ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ec961314-cf72-4d4e-bafe-b85a84ff6e7f
CPython Docs
file://datasets/cpython/Doc/library/timeit.rst
unknown
6f2dbd94-9a6e-4670-a512-3aa511f095fc
16,669
supabase-export-v2
a744a6f4f8f3601d
contain multi-line string literals. The statement will by default be executed within timeit's namespace; this behavior can be controlled by passing a namespace to *globals*. To measure the execution time of the first statement, use the :meth:`.timeit` method. The :meth:`.repeat` and :meth:`.autorange` methods are conv...
trusted_official_docs
CPython Docs
contain multi-line string literals. The statement will by default be executed within timeit's namespace; this behavior can be controlled by passing a namespace to *globals*. To measure the execution time of the first statement, use the :meth:`.timeit` method. The :meth:`.repeat` and :meth:`.autorange` methods are conv...
contain multi-line string literals. The statement will by default be executed within timeit's namespace; this behavior can be controlled by passing a namespace to *globals*. To measure the execution time of the first statement, use the :meth:`.timeit` method. The :meth:`.repeat` and :meth:`.autorange` methods are conv...
python, official-docs, cpython, P0
Local_Trusted_Corpus
edcff53a-8a35-4860-b8f1-d5747a1125b1
CPython Docs
file://datasets/cpython/Doc/library/timeit.rst
unknown
6f2dbd94-9a6e-4670-a512-3aa511f095fc
16,658
supabase-export-v2
65f05bc6a0a2facd
code and *timer* function and run its :meth:`.timeit` method with *number* executions. The optional *globals* argument specifies a namespace in which to execute the code. .. versionchanged:: 3.5 The optional *globals* parameter was added.
trusted_official_docs
CPython Docs
code and *timer* function and run its :meth:`.timeit` method with *number* executions. The optional *globals* argument specifies a namespace in which to execute the code. .. versionchanged:: 3.5 The optional *globals* parameter was added.
code and *timer* function and run its :meth:`.timeit` method with *number* executions. The optional *globals* argument specifies a namespace in which to execute the code. .. versionchanged:: 3.5 The optional *globals* parameter was added.
python, official-docs, cpython, P0
Local_Trusted_Corpus
f505f843-c46b-4f2e-bc1f-6da552a4785b
CPython Docs
file://datasets/cpython/Doc/library/timeit.rst
unknown
6f2dbd94-9a6e-4670-a512-3aa511f095fc
16,676
supabase-export-v2
97a169bca4142f66
.. note:: By default, :meth:`.timeit` temporarily turns off :term:`garbage collection` during the timing. The advantage of this approach is that it makes independent timings more comparable. The disadvantage is that GC may be an important component of the performance of the function being measured. If so, GC can be...
trusted_official_docs
CPython Docs
.. note:: By default, :meth:`.timeit` temporarily turns off :term:`garbage collection` during the timing. The advantage of this approach is that it makes independent timings more comparable. The disadvantage is that GC may be an important component of the performance of the function being measured. If so, GC can be...
.. note:: By default, :meth:`.timeit` temporarily turns off :term:`garbage collection` during the timing. The advantage of this approach is that it makes independent timings more comparable. The disadvantage is that GC may be an important component of the performance of the function being measured. If so, GC can be...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c6888e51-f469-4aaa-9744-af84acde384f
CPython Docs
file://datasets/cpython/Doc/library/smtpd.rst
unknown
5f5448ba-8d26-4fd7-af6a-0e84627e0bbd
16,747
supabase-export-v2
36c130bae69493cc
part of the Python standard library. It was :ref:`removed in Python 3.12 <whatsnew312-removed>` after being deprecated in Python 3.6. The removal was decided in :pep:`594`. A possible replacement is the third-party :pypi:`aiosmtpd` library. This library is not maintained or supported by the Python core team.
trusted_official_docs
CPython Docs
part of the Python standard library. It was :ref:`removed in Python 3.12 <whatsnew312-removed>` after being deprecated in Python 3.6. The removal was decided in :pep:`594`. A possible replacement is the third-party :pypi:`aiosmtpd` library. This library is not maintained or supported by the Python core team.
part of the Python standard library. It was :ref:`removed in Python 3.12 <whatsnew312-removed>` after being deprecated in Python 3.6. The removal was decided in :pep:`594`. A possible replacement is the third-party :pypi:`aiosmtpd` library. This library is not maintained or supported by the Python core team.
python, official-docs, cpython, P0
Local_Trusted_Corpus
caf4b110-24d1-4430-9ece-f9074734ce8f
CPython Docs
file://datasets/cpython/Doc/library/smtpd.rst
unknown
5f5448ba-8d26-4fd7-af6a-0e84627e0bbd
16,748
supabase-export-v2
25d13aaac41a262d
A possible replacement is the third-party :pypi:`aiosmtpd` library. This library is not maintained or supported by the Python core team. The last version of Python that provided the :mod:`!smtpd` module was `Python 3.11 <https://docs.python.org/3.11/library/smtpd.html>`_.
trusted_official_docs
CPython Docs
A possible replacement is the third-party :pypi:`aiosmtpd` library. This library is not maintained or supported by the Python core team. The last version of Python that provided the :mod:`!smtpd` module was `Python 3.11 <https://docs.python.org/3.11/library/smtpd.html>`_.
A possible replacement is the third-party :pypi:`aiosmtpd` library. This library is not maintained or supported by the Python core team. The last version of Python that provided the :mod:`!smtpd` module was `Python 3.11 <https://docs.python.org/3.11/library/smtpd.html>`_.
python, official-docs, cpython, P0
Local_Trusted_Corpus
f9907257-c515-474c-b0b1-752ef15e5bbc
CPython Docs
file://datasets/cpython/Doc/library/smtpd.rst
unknown
5f5448ba-8d26-4fd7-af6a-0e84627e0bbd
16,746
supabase-export-v2
97d9d1ebe83becfc
.. deprecated-removed:: 3.6 3.12 This module is no longer part of the Python standard library. It was :ref:`removed in Python 3.12 <whatsnew312-removed>` after being deprecated in Python 3.6. The removal was decided in :pep:`594`.
trusted_official_docs
CPython Docs
.. deprecated-removed:: 3.6 3.12 This module is no longer part of the Python standard library. It was :ref:`removed in Python 3.12 <whatsnew312-removed>` after being deprecated in Python 3.6. The removal was decided in :pep:`594`.
.. deprecated-removed:: 3.6 3.12 This module is no longer part of the Python standard library. It was :ref:`removed in Python 3.12 <whatsnew312-removed>` after being deprecated in Python 3.6. The removal was decided in :pep:`594`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
63f72c8e-c1aa-4079-8bfe-eba1f9d88fa0
CPython Docs
file://datasets/cpython/Doc/library/html.rst
unknown
d598b3cf-e98f-4b7c-9474-536faa3ed435
16,755
supabase-export-v2
dacd9ef3cd66ded6
.. function:: escape(s, quote=True) Convert the characters ``&``, ``<`` and ``>`` in string *s* to HTML-safe sequences. Use this if you need to display text that might contain such characters in HTML. If the optional flag *quote* is true (the default), the characters (``"``) and (``'``) are also translated; this hel...
trusted_official_docs
CPython Docs
.. function:: escape(s, quote=True) Convert the characters ``&``, ``<`` and ``>`` in string *s* to HTML-safe sequences. Use this if you need to display text that might contain such characters in HTML. If the optional flag *quote* is true (the default), the characters (``"``) and (``'``) are also translated; this hel...
.. function:: escape(s, quote=True) Convert the characters ``&``, ``<`` and ``>`` in string *s* to HTML-safe sequences. Use this if you need to display text that might contain such characters in HTML. If the optional flag *quote* is true (the default), the characters (``"``) and (``'``) are also translated; this hel...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d484abc4-9f22-48a7-b38f-02a5a61b3316
CPython Docs
file://datasets/cpython/Doc/library/html.rst
unknown
d598b3cf-e98f-4b7c-9474-536faa3ed435
16,757
supabase-export-v2
bb9fe22d90ce3474
.. function:: unescape(s) Convert all named and numeric character references (e.g. ``&gt;``, ``&#62;``, ``&#x3e;``) in the string *s* to the corresponding Unicode characters. This function uses the rules defined by the HTML 5 standard for both valid and invalid character references, and the :data:`list of HTML 5 na...
trusted_official_docs
CPython Docs
.. function:: unescape(s) Convert all named and numeric character references (e.g. ``&gt;``, ``&#62;``, ``&#x3e;``) in the string *s* to the corresponding Unicode characters. This function uses the rules defined by the HTML 5 standard for both valid and invalid character references, and the :data:`list of HTML 5 na...
.. function:: unescape(s) Convert all named and numeric character references (e.g. ``&gt;``, ``&#62;``, ``&#x3e;``) in the string *s* to the corresponding Unicode characters. This function uses the rules defined by the HTML 5 standard for both valid and invalid character references, and the :data:`list of HTML 5 na...
python, official-docs, cpython, P0
Local_Trusted_Corpus
068d801b-a382-4322-9570-09bb99d85566
CPython Docs
file://datasets/cpython/Doc/library/pipes.rst
unknown
5a2c26e7-3cb9-4326-882c-9005a8ba19f4
16,765
supabase-export-v2
5deff3704d11df96
part of the Python standard library. It was :ref:`removed in Python 3.13 <whatsnew313-pep594>` after being deprecated in Python 3.11. The removal was decided in :pep:`594`. Applications should use the :mod:`subprocess` module instead.
trusted_official_docs
CPython Docs
part of the Python standard library. It was :ref:`removed in Python 3.13 <whatsnew313-pep594>` after being deprecated in Python 3.11. The removal was decided in :pep:`594`. Applications should use the :mod:`subprocess` module instead.
part of the Python standard library. It was :ref:`removed in Python 3.13 <whatsnew313-pep594>` after being deprecated in Python 3.11. The removal was decided in :pep:`594`. Applications should use the :mod:`subprocess` module instead.
python, official-docs, cpython, P0
Local_Trusted_Corpus
00ecd362-4a83-421f-83ab-ae54ddf68545
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,903
supabase-export-v2
4b257c1caa6d46e4
@property def removed(self): return not self._finalizer.alive Defined like this, our finalizer only receives a reference to the details it needs to clean up the directory appropriately. If the object never gets garbage collected the finalizer will still be called at exit.
trusted_official_docs
CPython Docs
@property def removed(self): return not self._finalizer.alive Defined like this, our finalizer only receives a reference to the details it needs to clean up the directory appropriately. If the object never gets garbage collected the finalizer will still be called at exit.
@property def removed(self): return not self._finalizer.alive Defined like this, our finalizer only receives a reference to the details it needs to clean up the directory appropriately. If the object never gets garbage collected the finalizer will still be called at exit.
python, official-docs, cpython, P0
Local_Trusted_Corpus
02d9ba39-95c6-47aa-a93e-bea56bc45957
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,868
supabase-export-v2
60a69c47570b5355
be most useful to associate additional information with a reference, but could also be used to insert additional processing on calls to retrieve the referent. This example shows how a subclass of :class:`ref` can be used to store additional information about an object and affect the value that's returned when the refer...
trusted_official_docs
CPython Docs
be most useful to associate additional information with a reference, but could also be used to insert additional processing on calls to retrieve the referent. This example shows how a subclass of :class:`ref` can be used to store additional information about an object and affect the value that's returned when the refer...
be most useful to associate additional information with a reference, but could also be used to insert additional processing on calls to retrieve the referent. This example shows how a subclass of :class:`ref` can be used to store additional information about an object and affect the value that's returned when the refer...
python, official-docs, cpython, P0
Local_Trusted_Corpus
06ec0be4-23d3-468a-b657-e57e2355799c
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,882
supabase-export-v2
a16ad8f6475c8146
>>> kenny = Object() >>> weakref.finalize(kenny, print, "You killed Kenny!") #doctest:+ELLIPSIS <finalize object at ...; for 'Object' at ...> >>> del kenny You killed Kenny! The finalizer can be called directly as well. However the finalizer will invoke the callback at most once.
trusted_official_docs
CPython Docs
>>> kenny = Object() >>> weakref.finalize(kenny, print, "You killed Kenny!") #doctest:+ELLIPSIS <finalize object at ...; for 'Object' at ...> >>> del kenny You killed Kenny! The finalizer can be called directly as well. However the finalizer will invoke the callback at most once.
>>> kenny = Object() >>> weakref.finalize(kenny, print, "You killed Kenny!") #doctest:+ELLIPSIS <finalize object at ...; for 'Object' at ...> >>> del kenny You killed Kenny! The finalizer can be called directly as well. However the finalizer will invoke the callback at most once.
python, official-docs, cpython, P0
Local_Trusted_Corpus
07afa1ed-fc33-42e4-8842-9c76b82b9aad
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,776
supabase-export-v2
dcd57791070a18d7
or mappings holding large objects, where it's desired that a large object not be kept alive solely because it appears in a cache or mapping. For example, if you have a number of large binary image objects, you may wish to associate a name with each. If you used a Python dictionary to map names to images, or images to n...
trusted_official_docs
CPython Docs
or mappings holding large objects, where it's desired that a large object not be kept alive solely because it appears in a cache or mapping. For example, if you have a number of large binary image objects, you may wish to associate a name with each. If you used a Python dictionary to map names to images, or images to n...
or mappings holding large objects, where it's desired that a large object not be kept alive solely because it appears in a cache or mapping. For example, if you have a number of large binary image objects, you may wish to associate a name with each. If you used a Python dictionary to map names to images, or images to n...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0ae92dda-70ed-4eb2-8e60-a7f1d7103dda
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,864
supabase-export-v2
c4c26b9c3965bb6f
>>> del o, o2 >>> print(r()) None Testing that a weak reference object is still live should be done using the expression ``ref() is not None``. Normally, application code that needs to use a reference object should follow this pattern::
trusted_official_docs
CPython Docs
>>> del o, o2 >>> print(r()) None Testing that a weak reference object is still live should be done using the expression ``ref() is not None``. Normally, application code that needs to use a reference object should follow this pattern::
>>> del o, o2 >>> print(r()) None Testing that a weak reference object is still live should be done using the expression ``ref() is not None``. Normally, application code that needs to use a reference object should follow this pattern::
python, official-docs, cpython, P0
Local_Trusted_Corpus
140c6fbd-4e8f-44dd-82a0-dab5e7cfccea
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,899
supabase-export-v2
05a9a078b373b971
However, handling of :meth:`~object.__del__` methods is notoriously implementation specific, since it depends on internal details of the interpreter's garbage collector implementation. A more robust alternative can be to define a finalizer which only references the specific functions and objects that it needs, rather t...
trusted_official_docs
CPython Docs
However, handling of :meth:`~object.__del__` methods is notoriously implementation specific, since it depends on internal details of the interpreter's garbage collector implementation. A more robust alternative can be to define a finalizer which only references the specific functions and objects that it needs, rather t...
However, handling of :meth:`~object.__del__` methods is notoriously implementation specific, since it depends on internal details of the interpreter's garbage collector implementation. A more robust alternative can be to define a finalizer which only references the specific functions and objects that it needs, rather t...
python, official-docs, cpython, P0
Local_Trusted_Corpus
14113253-c548-493a-a738-6924f363cc17
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,897
supabase-export-v2
0e29db181c0e6149
def __del__(self): self.remove() Starting with Python 3.4, :meth:`~object.__del__` methods no longer prevent reference cycles from being garbage collected, and module globals are no longer forced to :const:`None` during :term:`interpreter shutdown`. So this code should work without any issues on CPython.
trusted_official_docs
CPython Docs
def __del__(self): self.remove() Starting with Python 3.4, :meth:`~object.__del__` methods no longer prevent reference cycles from being garbage collected, and module globals are no longer forced to :const:`None` during :term:`interpreter shutdown`. So this code should work without any issues on CPython.
def __del__(self): self.remove() Starting with Python 3.4, :meth:`~object.__del__` methods no longer prevent reference cycles from being garbage collected, and module globals are no longer forced to :const:`None` during :term:`interpreter shutdown`. So this code should work without any issues on CPython.
python, official-docs, cpython, P0
Local_Trusted_Corpus
1750bb9a-4dc7-4eef-a6cc-aa3bfb3abcc4
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,905
supabase-export-v2
4bfa5d138db82084
be used to register finalizers for classes where the definition is controlled by a third party, such as running code when a module is unloaded:: import weakref, sys def unloading_module(): # implicit reference to the module globals from the function body weakref.finalize(sys.modules[__name__], unloading_module)
trusted_official_docs
CPython Docs
be used to register finalizers for classes where the definition is controlled by a third party, such as running code when a module is unloaded:: import weakref, sys def unloading_module(): # implicit reference to the module globals from the function body weakref.finalize(sys.modules[__name__], unloading_module)
be used to register finalizers for classes where the definition is controlled by a third party, such as running code when a module is unloaded:: import weakref, sys def unloading_module(): # implicit reference to the module globals from the function body weakref.finalize(sys.modules[__name__], unloading_module)
python, official-docs, cpython, P0
Local_Trusted_Corpus
18f52aa0-2dee-4ba0-8f15-3b940fe60cbc
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,827
supabase-export-v2
2b87523d8fd7ee38
weak reference cannot keep hold of it. :class:`WeakMethod` has special code to recreate the bound method until either the object or the original function dies:: >>> class C: ... def method(self): ... print("method called!") ... >>> c = C() >>> r = weakref.ref(c.method) >>> r() >>> r = weakref.WeakMethod(c.method)...
trusted_official_docs
CPython Docs
weak reference cannot keep hold of it. :class:`WeakMethod` has special code to recreate the bound method until either the object or the original function dies:: >>> class C: ... def method(self): ... print("method called!") ... >>> c = C() >>> r = weakref.ref(c.method) >>> r() >>> r = weakref.WeakMethod(c.method)...
weak reference cannot keep hold of it. :class:`WeakMethod` has special code to recreate the bound method until either the object or the original function dies:: >>> class C: ... def method(self): ... print("method called!") ... >>> c = C() >>> r = weakref.ref(c.method) >>> r() >>> r = weakref.WeakMethod(c.method)...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1a443253-1919-42ca-930e-a1a6c8a8f305
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,847
supabase-export-v2
42f83dae3f9c2f5d
.. note:: It is important to ensure that *func*, *args* and *kwargs* do not own any references to *obj*, either directly or indirectly, since otherwise *obj* will never be garbage collected. In particular, *func* should not be a bound method of *obj*.
trusted_official_docs
CPython Docs
.. note:: It is important to ensure that *func*, *args* and *kwargs* do not own any references to *obj*, either directly or indirectly, since otherwise *obj* will never be garbage collected. In particular, *func* should not be a bound method of *obj*.
.. note:: It is important to ensure that *func*, *args* and *kwargs* do not own any references to *obj*, either directly or indirectly, since otherwise *obj* will never be garbage collected. In particular, *func* should not be a bound method of *obj*.
python, official-docs, cpython, P0
Local_Trusted_Corpus
1ded1d49-a17b-4e47-b35a-89ad34edbb94
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,797
supabase-export-v2
452c5ba2cddc15ce
.. attribute:: __callback__ This read-only attribute returns the callback currently associated to the weakref. If there is no callback or if the referent of the weakref is no longer alive then this attribute will have value ``None``.
trusted_official_docs
CPython Docs
.. attribute:: __callback__ This read-only attribute returns the callback currently associated to the weakref. If there is no callback or if the referent of the weakref is no longer alive then this attribute will have value ``None``.
.. attribute:: __callback__ This read-only attribute returns the callback currently associated to the weakref. If there is no callback or if the referent of the weakref is no longer alive then this attribute will have value ``None``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
3222611c-e18f-41c1-b001-33d0661d7de0
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,855
supabase-export-v2
50dcdf08e0500ca9
.. data:: ProxyTypes Sequence containing all the type objects for proxies. This can make it simpler to test if an object is a proxy without being dependent on naming both proxy types.
trusted_official_docs
CPython Docs
.. data:: ProxyTypes Sequence containing all the type objects for proxies. This can make it simpler to test if an object is a proxy without being dependent on naming both proxy types.
.. data:: ProxyTypes Sequence containing all the type objects for proxies. This can make it simpler to test if an object is a proxy without being dependent on naming both proxy types.
python, official-docs, cpython, P0
Local_Trusted_Corpus
36923d15-0115-4116-986e-e30f45fa81c8
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,892
supabase-export-v2
d2798dc6be983ec8
* the object is garbage collected, * the object's :meth:`!remove` method is called, or * the program exits. We might try to implement the class using a :meth:`~object.__del__` method as follows::
trusted_official_docs
CPython Docs
* the object is garbage collected, * the object's :meth:`!remove` method is called, or * the program exits. We might try to implement the class using a :meth:`~object.__del__` method as follows::
* the object is garbage collected, * the object's :meth:`!remove` method is called, or * the program exits. We might try to implement the class using a :meth:`~object.__del__` method as follows::
python, official-docs, cpython, P0
Local_Trusted_Corpus
397162e2-b329-4cfc-8517-6fce77af86ed
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,883
supabase-export-v2
8b5c4176b834cdfd
The finalizer can be called directly as well. However the finalizer will invoke the callback at most once. >>> def callback(x, y, z): ... print("CALLBACK") ... return x + y + z ... >>> obj = Object() >>> f = weakref.finalize(obj, callback, 1, 2, z=3) >>> assert f.alive >>> assert f() == 6 CALLBACK >>> assert no...
trusted_official_docs
CPython Docs
The finalizer can be called directly as well. However the finalizer will invoke the callback at most once. >>> def callback(x, y, z): ... print("CALLBACK") ... return x + y + z ... >>> obj = Object() >>> f = weakref.finalize(obj, callback, 1, 2, z=3) >>> assert f.alive >>> assert f() == 6 CALLBACK >>> assert no...
The finalizer can be called directly as well. However the finalizer will invoke the callback at most once. >>> def callback(x, y, z): ... print("CALLBACK") ... return x + y + z ... >>> obj = Object() >>> f = weakref.finalize(obj, callback, 1, 2, z=3) >>> assert f.alive >>> assert f() == 6 CALLBACK >>> assert no...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3c56b7ad-9aae-4f8d-8e61-1d128d979034
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,889
supabase-export-v2
532b39d0f4fecb94
>>> obj = Object() >>> weakref.finalize(obj, print, "obj dead or exiting") <finalize object at ...; for 'Object' at ...> >>> exit() obj dead or exiting Comparing finalizers with :meth:`~object.__del__` methods ---------------------------------------------------------
trusted_official_docs
CPython Docs
>>> obj = Object() >>> weakref.finalize(obj, print, "obj dead or exiting") <finalize object at ...; for 'Object' at ...> >>> exit() obj dead or exiting Comparing finalizers with :meth:`~object.__del__` methods ---------------------------------------------------------
>>> obj = Object() >>> weakref.finalize(obj, print, "obj dead or exiting") <finalize object at ...; for 'Object' at ...> >>> exit() obj dead or exiting Comparing finalizers with :meth:`~object.__del__` methods ---------------------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
3ceadf6a-aab3-4b35-8ce9-9fb25b06730f
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,904
supabase-export-v2
3a657eaa9139a9bd
the details it needs to clean up the directory appropriately. If the object never gets garbage collected the finalizer will still be called at exit. The other advantage of weakref based finalizers is that they can be used to register finalizers for classes where the definition is controlled by a third party, such as ru...
trusted_official_docs
CPython Docs
the details it needs to clean up the directory appropriately. If the object never gets garbage collected the finalizer will still be called at exit. The other advantage of weakref based finalizers is that they can be used to register finalizers for classes where the definition is controlled by a third party, such as ru...
the details it needs to clean up the directory appropriately. If the object never gets garbage collected the finalizer will still be called at exit. The other advantage of weakref based finalizers is that they can be used to register finalizers for classes where the definition is controlled by a third party, such as ru...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3e70bc14-1774-45f6-b5f9-eda6a2329b63
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,826
supabase-export-v2
40571b9281fe7750
.. class:: WeakMethod(method[, callback]) A custom :class:`ref` subclass which simulates a weak reference to a bound method (i.e., a method defined on a class and looked up on an instance). Since a bound method is ephemeral, a standard weak reference cannot keep hold of it. :class:`WeakMethod` has special code to rec...
trusted_official_docs
CPython Docs
.. class:: WeakMethod(method[, callback]) A custom :class:`ref` subclass which simulates a weak reference to a bound method (i.e., a method defined on a class and looked up on an instance). Since a bound method is ephemeral, a standard weak reference cannot keep hold of it. :class:`WeakMethod` has special code to rec...
.. class:: WeakMethod(method[, callback]) A custom :class:`ref` subclass which simulates a weak reference to a bound method (i.e., a method defined on a class and looked up on an instance). Since a bound method is ephemeral, a standard weak reference cannot keep hold of it. :class:`WeakMethod` has special code to rec...
python, official-docs, cpython, P0
Local_Trusted_Corpus
48b0774c-15d4-41c6-8579-5dbbb13776a9
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,862
supabase-export-v2
dc50a40b7fe8726f
import weakref >>> class Object: ... pass ... >>> o = Object() >>> r = weakref.ref(o) >>> o2 = r() >>> o is o2 True If the referent no longer exists, calling the reference object returns :const:`None`:
trusted_official_docs
CPython Docs
import weakref >>> class Object: ... pass ... >>> o = Object() >>> r = weakref.ref(o) >>> o2 = r() >>> o is o2 True If the referent no longer exists, calling the reference object returns :const:`None`:
import weakref >>> class Object: ... pass ... >>> o = Object() >>> r = weakref.ref(o) >>> o2 = r() >>> o is o2 True If the referent no longer exists, calling the reference object returns :const:`None`:
python, official-docs, cpython, P0
Local_Trusted_Corpus
49a90ff0-10ea-477e-a747-38f00d87b572
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,833
supabase-export-v2
42828579a5cc1720
collection), and after that it is *dead*. Calling a live finalizer returns the result of evaluating ``func(*arg, **kwargs)``, whereas calling a dead finalizer returns :const:`None`. Exceptions raised by finalizer callbacks during garbage collection will be shown on the standard error output, but cannot be propagated....
trusted_official_docs
CPython Docs
collection), and after that it is *dead*. Calling a live finalizer returns the result of evaluating ``func(*arg, **kwargs)``, whereas calling a dead finalizer returns :const:`None`. Exceptions raised by finalizer callbacks during garbage collection will be shown on the standard error output, but cannot be propagated....
collection), and after that it is *dead*. Calling a live finalizer returns the result of evaluating ``func(*arg, **kwargs)``, whereas calling a dead finalizer returns :const:`None`. Exceptions raised by finalizer callbacks during garbage collection will be shown on the standard error output, but cannot be propagated....
python, official-docs, cpython, P0
Local_Trusted_Corpus
4a805d11-0c57-4a71-9311-31e5a54d3b5c
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,792
supabase-export-v2
b672193f6a96b7c9
constructed for the same object. Callbacks registered for each weak reference will be called from the most recently registered callback to the oldest registered callback. Exceptions raised by the callback will be noted on the standard error output, but cannot be propagated; they are handled in exactly the same way as ...
trusted_official_docs
CPython Docs
constructed for the same object. Callbacks registered for each weak reference will be called from the most recently registered callback to the oldest registered callback. Exceptions raised by the callback will be noted on the standard error output, but cannot be propagated; they are handled in exactly the same way as ...
constructed for the same object. Callbacks registered for each weak reference will be called from the most recently registered callback to the oldest registered callback. Exceptions raised by the callback will be noted on the standard error output, but cannot be propagated; they are handled in exactly the same way as ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4aa2fdf7-4e17-4496-a5ea-04150e7e4809
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,809
supabase-export-v2
29ae2e8b05638cad
object owned by other parts of an application without adding attributes to those objects. This can be especially useful with objects that override attribute accesses. Note that when a key with equal value to an existing key (but not equal identity) is inserted into the dictionary, it replaces the value but does not re...
trusted_official_docs
CPython Docs
object owned by other parts of an application without adding attributes to those objects. This can be especially useful with objects that override attribute accesses. Note that when a key with equal value to an existing key (but not equal identity) is inserted into the dictionary, it replaces the value but does not re...
object owned by other parts of an application without adding attributes to those objects. This can be especially useful with objects that override attribute accesses. Note that when a key with equal value to an existing key (but not equal identity) is inserted into the dictionary, it replaces the value but does not re...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4fca5f73-868a-4e32-8c1c-55de69175427
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,898
supabase-export-v2
b0cf0b8f1126f79d
being garbage collected, and module globals are no longer forced to :const:`None` during :term:`interpreter shutdown`. So this code should work without any issues on CPython. However, handling of :meth:`~object.__del__` methods is notoriously implementation specific, since it depends on internal details of the interpre...
trusted_official_docs
CPython Docs
being garbage collected, and module globals are no longer forced to :const:`None` during :term:`interpreter shutdown`. So this code should work without any issues on CPython. However, handling of :meth:`~object.__del__` methods is notoriously implementation specific, since it depends on internal details of the interpre...
being garbage collected, and module globals are no longer forced to :const:`None` during :term:`interpreter shutdown`. So this code should work without any issues on CPython. However, handling of :meth:`~object.__del__` methods is notoriously implementation specific, since it depends on internal details of the interpre...
python, official-docs, cpython, P0
Local_Trusted_Corpus
515d15f5-6b38-428d-a74c-b813fc7b6f01
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,900
supabase-export-v2
bcf21a6101ce77ad
define a finalizer which only references the specific functions and objects that it needs, rather than having access to the full state of the object:: class TempDir: def __init__(self): self.name = tempfile.mkdtemp() self._finalizer = weakref.finalize(self, shutil.rmtree, self.name)
trusted_official_docs
CPython Docs
define a finalizer which only references the specific functions and objects that it needs, rather than having access to the full state of the object:: class TempDir: def __init__(self): self.name = tempfile.mkdtemp() self._finalizer = weakref.finalize(self, shutil.rmtree, self.name)
define a finalizer which only references the specific functions and objects that it needs, rather than having access to the full state of the object:: class TempDir: def __init__(self): self.name = tempfile.mkdtemp() self._finalizer = weakref.finalize(self, shutil.rmtree, self.name)
python, official-docs, cpython, P0
Local_Trusted_Corpus
5aff0cc8-d049-4fe3-a55e-d117075d5142
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,874
supabase-export-v2
1ba364ce2e2cbf02
be used in other data structures without forcing the objects to remain alive, but the objects can still be retrieved by ID if they do. .. Example contributed by Tim Peters.
trusted_official_docs
CPython Docs
be used in other data structures without forcing the objects to remain alive, but the objects can still be retrieved by ID if they do. .. Example contributed by Tim Peters.
be used in other data structures without forcing the objects to remain alive, but the objects can still be retrieved by ID if they do. .. Example contributed by Tim Peters.
python, official-docs, cpython, P0
Local_Trusted_Corpus
5b8220b5-ed7f-412c-bdff-893ed115e1ac
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,891
supabase-export-v2
9af00aeba0cef7d2
to create a class whose instances represent temporary directories. The directories should be deleted with their contents when the first of the following events occurs: * the object is garbage collected, * the object's :meth:`!remove` method is called, or * the program exits.
trusted_official_docs
CPython Docs
to create a class whose instances represent temporary directories. The directories should be deleted with their contents when the first of the following events occurs: * the object is garbage collected, * the object's :meth:`!remove` method is called, or * the program exits.
to create a class whose instances represent temporary directories. The directories should be deleted with their contents when the first of the following events occurs: * the object is garbage collected, * the object's :meth:`!remove` method is called, or * the program exits.
python, official-docs, cpython, P0
Local_Trusted_Corpus
5e261b18-d752-4af2-9f9f-5a00a8a6743c
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,845
supabase-export-v2
39302f7f80c416ae
.. attribute:: atexit A writable boolean property which by default is true. When the program exits, it calls all remaining live finalizers for which :attr:`.atexit` is true. They are called in reverse order of creation.
trusted_official_docs
CPython Docs
.. attribute:: atexit A writable boolean property which by default is true. When the program exits, it calls all remaining live finalizers for which :attr:`.atexit` is true. They are called in reverse order of creation.
.. attribute:: atexit A writable boolean property which by default is true. When the program exits, it calls all remaining live finalizers for which :attr:`.atexit` is true. They are called in reverse order of creation.
python, official-docs, cpython, P0
Local_Trusted_Corpus
60534566-9810-4cbb-b479-ff688b30d7dd
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,779
supabase-export-v2
32fbca57bbb32a39
setting up a callback function on a raw weak reference, since the module automatically ensures that the finalizer remains alive until the object is collected. Most programs should find that using one of these weak container types or :class:`finalize` is all they need -- it's not usually necessary to create your own wea...
trusted_official_docs
CPython Docs
setting up a callback function on a raw weak reference, since the module automatically ensures that the finalizer remains alive until the object is collected. Most programs should find that using one of these weak container types or :class:`finalize` is all they need -- it's not usually necessary to create your own wea...
setting up a callback function on a raw weak reference, since the module automatically ensures that the finalizer remains alive until the object is collected. Most programs should find that using one of these weak container types or :class:`finalize` is all they need -- it's not usually necessary to create your own wea...
python, official-docs, cpython, P0
Local_Trusted_Corpus
63565cba-df56-45d8-880f-2c06adb16714
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,819
supabase-export-v2
9e63c4f58a5b8365
Mapping class that references values weakly. Entries in the dictionary will be discarded when no strong reference to the value exists any more. .. versionchanged:: 3.9 Added support for ``|`` and ``|=`` operators, as specified in :pep:`584`.
trusted_official_docs
CPython Docs
Mapping class that references values weakly. Entries in the dictionary will be discarded when no strong reference to the value exists any more. .. versionchanged:: 3.9 Added support for ``|`` and ``|=`` operators, as specified in :pep:`584`.
Mapping class that references values weakly. Entries in the dictionary will be discarded when no strong reference to the value exists any more. .. versionchanged:: 3.9 Added support for ``|`` and ``|=`` operators, as specified in :pep:`584`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
73592e56-9f6f-4328-91e6-b1c7b0614b10
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,777
supabase-export-v2
e6e7a82d4eba6a7e
object are the weak references held by weak mappings, garbage collection can reclaim the object, and its corresponding entries in weak mappings are simply deleted. :class:`WeakKeyDictionary` and :class:`WeakValueDictionary` use weak references in their implementation, setting up callback functions on the weak reference...
trusted_official_docs
CPython Docs
object are the weak references held by weak mappings, garbage collection can reclaim the object, and its corresponding entries in weak mappings are simply deleted. :class:`WeakKeyDictionary` and :class:`WeakValueDictionary` use weak references in their implementation, setting up callback functions on the weak reference...
object are the weak references held by weak mappings, garbage collection can reclaim the object, and its corresponding entries in weak mappings are simply deleted. :class:`WeakKeyDictionary` and :class:`WeakValueDictionary` use weak references in their implementation, setting up callback functions on the weak reference...
python, official-docs, cpython, P0
Local_Trusted_Corpus
75b62c6d-3e86-4bf1-98e6-46f68a40a339
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,835
supabase-export-v2
aad90f28ab46886a
program exits, each remaining live finalizer is called unless its :attr:`atexit` attribute has been set to false. They are called in reverse order of creation. A finalizer will never invoke its callback during the later part of the :term:`interpreter shutdown` when module globals are liable to have been replaced by :...
trusted_official_docs
CPython Docs
program exits, each remaining live finalizer is called unless its :attr:`atexit` attribute has been set to false. They are called in reverse order of creation. A finalizer will never invoke its callback during the later part of the :term:`interpreter shutdown` when module globals are liable to have been replaced by :...
program exits, each remaining live finalizer is called unless its :attr:`atexit` attribute has been set to false. They are called in reverse order of creation. A finalizer will never invoke its callback during the later part of the :term:`interpreter shutdown` when module globals are liable to have been replaced by :...
python, official-docs, cpython, P0
Local_Trusted_Corpus
75da9868-9f09-4d3c-8ee4-34f8d6721238
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,884
supabase-export-v2
8929e9d8cb975346
6 CALLBACK >>> assert not f.alive >>> f() # callback not called because finalizer dead >>> del obj # callback not called because finalizer dead You can unregister a finalizer using its :meth:`~finalize.detach` method. This kills the finalizer and returns the arguments passed to the constructor when it was created.
trusted_official_docs
CPython Docs
6 CALLBACK >>> assert not f.alive >>> f() # callback not called because finalizer dead >>> del obj # callback not called because finalizer dead You can unregister a finalizer using its :meth:`~finalize.detach` method. This kills the finalizer and returns the arguments passed to the constructor when it was created.
6 CALLBACK >>> assert not f.alive >>> f() # callback not called because finalizer dead >>> del obj # callback not called because finalizer dead You can unregister a finalizer using its :meth:`~finalize.detach` method. This kills the finalizer and returns the arguments passed to the constructor when it was created.
python, official-docs, cpython, P0
Local_Trusted_Corpus
75f1cadc-ed66-486a-a40a-73f3d2e3c4d0
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,865
supabase-export-v2
7ec5ea55b35f3681
live should be done using the expression ``ref() is not None``. Normally, application code that needs to use a reference object should follow this pattern:: # r is a weak reference object o = r() if o is None: # referent has been garbage collected print("Object has been deallocated; can't frobnicate.") else: prin...
trusted_official_docs
CPython Docs
live should be done using the expression ``ref() is not None``. Normally, application code that needs to use a reference object should follow this pattern:: # r is a weak reference object o = r() if o is None: # referent has been garbage collected print("Object has been deallocated; can't frobnicate.") else: prin...
live should be done using the expression ``ref() is not None``. Normally, application code that needs to use a reference object should follow this pattern:: # r is a weak reference object o = r() if o is None: # referent has been garbage collected print("Object has been deallocated; can't frobnicate.") else: prin...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7d837cf6-2983-4cc8-a8e5-62f5fccd3427
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,810
supabase-export-v2
7a9a0d4acb0bcd7a
not replace the existing key. Due to this, when the reference to the original key is deleted, it also deletes the entry in the dictionary:: >>> class T(str): pass ... >>> k1, k2 = T(), T() >>> d = weakref.WeakKeyDictionary() >>> d[k1] = 1 # d = {k1: 1} >>> d[k2] = 2 # d = {k1: 2} >>> del k1 # d = {}
trusted_official_docs
CPython Docs
not replace the existing key. Due to this, when the reference to the original key is deleted, it also deletes the entry in the dictionary:: >>> class T(str): pass ... >>> k1, k2 = T(), T() >>> d = weakref.WeakKeyDictionary() >>> d[k1] = 1 # d = {k1: 1} >>> d[k2] = 2 # d = {k1: 2} >>> del k1 # d = {}
not replace the existing key. Due to this, when the reference to the original key is deleted, it also deletes the entry in the dictionary:: >>> class T(str): pass ... >>> k1, k2 = T(), T() >>> d = weakref.WeakKeyDictionary() >>> d[k1] = 1 # d = {k1: 1} >>> d[k2] = 2 # d = {k1: 2} >>> del k1 # d = {}
python, official-docs, cpython, P0
Local_Trusted_Corpus
7e188903-c65a-4248-825c-995a2212dd75
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,885
supabase-export-v2
34b29c87d3bd8c02
You can unregister a finalizer using its :meth:`~finalize.detach` method. This kills the finalizer and returns the arguments passed to the constructor when it was created. >>> obj = Object() >>> f = weakref.finalize(obj, callback, 1, 2, z=3) >>> f.detach() #doctest:+ELLIPSIS (<...Object object ...>, <function callba...
trusted_official_docs
CPython Docs
You can unregister a finalizer using its :meth:`~finalize.detach` method. This kills the finalizer and returns the arguments passed to the constructor when it was created. >>> obj = Object() >>> f = weakref.finalize(obj, callback, 1, 2, z=3) >>> f.detach() #doctest:+ELLIPSIS (<...Object object ...>, <function callba...
You can unregister a finalizer using its :meth:`~finalize.detach` method. This kills the finalizer and returns the arguments passed to the constructor when it was created. >>> obj = Object() >>> f = weakref.finalize(obj, callback, 1, 2, z=3) >>> f.detach() #doctest:+ELLIPSIS (<...Object object ...>, <function callba...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7e685a3f-2390-452f-9358-bafc45d23ba3
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,860
supabase-export-v2
9bb909657cc91cd4
Weak Reference Objects ---------------------- Weak reference objects have no methods and no attributes besides :attr:`ref.__callback__`. A weak reference object allows the referent to be obtained, if it still exists, by calling it:
trusted_official_docs
CPython Docs
Weak Reference Objects ---------------------- Weak reference objects have no methods and no attributes besides :attr:`ref.__callback__`. A weak reference object allows the referent to be obtained, if it still exists, by calling it:
Weak Reference Objects ---------------------- Weak reference objects have no methods and no attributes besides :attr:`ref.__callback__`. A weak reference object allows the referent to be obtained, if it still exists, by calling it:
python, official-docs, cpython, P0
Local_Trusted_Corpus
825f9089-7384-4653-b993-1be5f1156ead
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,778
supabase-export-v2
1751f55a6938851d
or value has been reclaimed by garbage collection. :class:`WeakSet` implements the :class:`set` interface, but keeps weak references to its elements, just like a :class:`WeakKeyDictionary` does. :class:`finalize` provides a straight forward way to register a cleanup function to be called when an object is garbage colle...
trusted_official_docs
CPython Docs
or value has been reclaimed by garbage collection. :class:`WeakSet` implements the :class:`set` interface, but keeps weak references to its elements, just like a :class:`WeakKeyDictionary` does. :class:`finalize` provides a straight forward way to register a cleanup function to be called when an object is garbage colle...
or value has been reclaimed by garbage collection. :class:`WeakSet` implements the :class:`set` interface, but keeps weak references to its elements, just like a :class:`WeakKeyDictionary` does. :class:`finalize` provides a straight forward way to register a cleanup function to be called when an object is garbage colle...
python, official-docs, cpython, P0
Local_Trusted_Corpus
866bd777-11c9-4250-922f-001499b12bcf
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,795
supabase-export-v2
b0b1ae1701bc0f2a
their referents (regardless of the *callback*). If either referent has been deleted, the references are equal only if the reference objects are the same object. This is a subclassable type rather than a factory function.
trusted_official_docs
CPython Docs
their referents (regardless of the *callback*). If either referent has been deleted, the references are equal only if the reference objects are the same object. This is a subclassable type rather than a factory function.
their referents (regardless of the *callback*). If either referent has been deleted, the references are equal only if the reference objects are the same object. This is a subclassable type rather than a factory function.
python, official-docs, cpython, P0
Local_Trusted_Corpus
87eeb7e5-3ee5-44cb-884e-0a27679382eb
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,800
supabase-export-v2
3331bf819c72ac32
.. function:: proxy(object[, callback]) Return a proxy to *object* which uses a weak reference. This supports use of the proxy in most contexts instead of requiring the explicit dereferencing used with weak reference objects. The returned object will have a type of either ``ProxyType`` or ``CallableProxyType``, depe...
trusted_official_docs
CPython Docs
.. function:: proxy(object[, callback]) Return a proxy to *object* which uses a weak reference. This supports use of the proxy in most contexts instead of requiring the explicit dereferencing used with weak reference objects. The returned object will have a type of either ``ProxyType`` or ``CallableProxyType``, depe...
.. function:: proxy(object[, callback]) Return a proxy to *object* which uses a weak reference. This supports use of the proxy in most contexts instead of requiring the explicit dereferencing used with weak reference objects. The returned object will have a type of either ``ProxyType`` or ``CallableProxyType``, depe...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8c7dd666-48d1-4226-9709-a7b1703d9ca9
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,881
supabase-export-v2
10d4106b2b28f583
main benefit of using :class:`finalize` is that it makes it simple to register a callback without needing to preserve the returned finalizer object. For instance >>> import weakref >>> class Object: ... pass ... >>> kenny = Object() >>> weakref.finalize(kenny, print, "You killed Kenny!") #doctest:+ELLIPSIS <finali...
trusted_official_docs
CPython Docs
main benefit of using :class:`finalize` is that it makes it simple to register a callback without needing to preserve the returned finalizer object. For instance >>> import weakref >>> class Object: ... pass ... >>> kenny = Object() >>> weakref.finalize(kenny, print, "You killed Kenny!") #doctest:+ELLIPSIS <finali...
main benefit of using :class:`finalize` is that it makes it simple to register a callback without needing to preserve the returned finalizer object. For instance >>> import weakref >>> class Object: ... pass ... >>> kenny = Object() >>> weakref.finalize(kenny, print, "You killed Kenny!") #doctest:+ELLIPSIS <finali...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8de18307-76ae-499a-a7a6-730eeb16ca4b
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,774
supabase-export-v2
37523469c87d4ded
In the following, the term :dfn:`referent` means the object which is referred to by a weak reference. A weak reference to an object is not enough to keep the object alive: when the only remaining references to a referent are weak references, :term:`garbage collection` is free to destroy the referent and reuse its memor...
trusted_official_docs
CPython Docs
In the following, the term :dfn:`referent` means the object which is referred to by a weak reference. A weak reference to an object is not enough to keep the object alive: when the only remaining references to a referent are weak references, :term:`garbage collection` is free to destroy the referent and reuse its memor...
In the following, the term :dfn:`referent` means the object which is referred to by a weak reference. A weak reference to an object is not enough to keep the object alive: when the only remaining references to a referent are weak references, :term:`garbage collection` is free to destroy the referent and reuse its memor...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8df7d5c7-23d3-4e66-896d-2cf92ee16421
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,808
supabase-export-v2
16071b9ce848eb5c
.. class:: WeakKeyDictionary([dict]) Mapping class that references keys weakly. Entries in the dictionary will be discarded when there is no longer a strong reference to the key. This can be used to associate additional data with an object owned by other parts of an application without adding attributes to those obj...
trusted_official_docs
CPython Docs
.. class:: WeakKeyDictionary([dict]) Mapping class that references keys weakly. Entries in the dictionary will be discarded when there is no longer a strong reference to the key. This can be used to associate additional data with an object owned by other parts of an application without adding attributes to those obj...
.. class:: WeakKeyDictionary([dict]) Mapping class that references keys weakly. Entries in the dictionary will be discarded when there is no longer a strong reference to the key. This can be used to associate additional data with an object owned by other parts of an application without adding attributes to those obj...
python, official-docs, cpython, P0
Local_Trusted_Corpus
92f940c9-299a-4336-b010-5f9f1b2a2379
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,791
supabase-export-v2
5302a676f0c68534
about to be finalized; the weak reference object will be passed as the only parameter to the callback; the referent will no longer be available. It is allowable for many weak references to be constructed for the same object. Callbacks registered for each weak reference will be called from the most recently registered ...
trusted_official_docs
CPython Docs
about to be finalized; the weak reference object will be passed as the only parameter to the callback; the referent will no longer be available. It is allowable for many weak references to be constructed for the same object. Callbacks registered for each weak reference will be called from the most recently registered ...
about to be finalized; the weak reference object will be passed as the only parameter to the callback; the referent will no longer be available. It is allowable for many weak references to be constructed for the same object. Callbacks registered for each weak reference will be called from the most recently registered ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9c3b7a12-fb17-4225-b2ea-6fc6f202e3be
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,873
supabase-export-v2
f339a02672795983
Example ------- This simple example shows how an application can use object IDs to retrieve objects that it has seen before. The IDs of the objects can then be used in other data structures without forcing the objects to remain alive, but the objects can still be retrieved by ID if they do.
trusted_official_docs
CPython Docs
Example ------- This simple example shows how an application can use object IDs to retrieve objects that it has seen before. The IDs of the objects can then be used in other data structures without forcing the objects to remain alive, but the objects can still be retrieved by ID if they do.
Example ------- This simple example shows how an application can use object IDs to retrieve objects that it has seen before. The IDs of the objects can then be used in other data structures without forcing the objects to remain alive, but the objects can still be retrieved by ID if they do.
python, official-docs, cpython, P0
Local_Trusted_Corpus
a7412fd3-b4dc-49cb-812d-26eb6724ee64
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,775
supabase-export-v2
30b7abc5d572e9a5
something else. However, until the object is actually destroyed the weak reference may return the object even if there are no strong references to it. A primary use for weak references is to implement caches or mappings holding large objects, where it's desired that a large object not be kept alive solely because it ap...
trusted_official_docs
CPython Docs
something else. However, until the object is actually destroyed the weak reference may return the object even if there are no strong references to it. A primary use for weak references is to implement caches or mappings holding large objects, where it's desired that a large object not be kept alive solely because it ap...
something else. However, until the object is actually destroyed the weak reference may return the object even if there are no strong references to it. A primary use for weak references is to implement caches or mappings holding large objects, where it's desired that a large object not be kept alive solely because it ap...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ab2afc38-edc1-4a24-ac45-1bfbb83fa105
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,793
supabase-export-v2
544c439e807b77f3
on the standard error output, but cannot be propagated; they are handled in exactly the same way as exceptions raised from an object's :meth:`~object.__del__` method. Weak references are :term:`hashable` if the *object* is hashable. They will maintain their hash value even after the *object* was deleted. If :func:`ha...
trusted_official_docs
CPython Docs
on the standard error output, but cannot be propagated; they are handled in exactly the same way as exceptions raised from an object's :meth:`~object.__del__` method. Weak references are :term:`hashable` if the *object* is hashable. They will maintain their hash value even after the *object* was deleted. If :func:`ha...
on the standard error output, but cannot be propagated; they are handled in exactly the same way as exceptions raised from an object's :meth:`~object.__del__` method. Weak references are :term:`hashable` if the *object* is hashable. They will maintain their hash value even after the *object* was deleted. If :func:`ha...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b02d0a1c-8118-44fd-814c-e05b221f5cec
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,773
supabase-export-v2
b09431006b42b513
.. When making changes to the examples in this file, be sure to update Lib/test/test_weakref.py::libreftest too! In the following, the term :dfn:`referent` means the object which is referred to by a weak reference.
trusted_official_docs
CPython Docs
.. When making changes to the examples in this file, be sure to update Lib/test/test_weakref.py::libreftest too! In the following, the term :dfn:`referent` means the object which is referred to by a weak reference.
.. When making changes to the examples in this file, be sure to update Lib/test/test_weakref.py::libreftest too! In the following, the term :dfn:`referent` means the object which is referred to by a weak reference.
python, official-docs, cpython, P0
Local_Trusted_Corpus
b3817696-b7c1-492f-97ba-ad4b523792b0
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,782
supabase-export-v2
d1ec341a64a93863
.. versionchanged:: 3.2 Added support for thread.lock, threading.Lock, and code objects. Several built-in types such as :class:`list` and :class:`dict` do not directly support weak references but can add support through subclassing::
trusted_official_docs
CPython Docs
.. versionchanged:: 3.2 Added support for thread.lock, threading.Lock, and code objects. Several built-in types such as :class:`list` and :class:`dict` do not directly support weak references but can add support through subclassing::
.. versionchanged:: 3.2 Added support for thread.lock, threading.Lock, and code objects. Several built-in types such as :class:`list` and :class:`dict` do not directly support weak references but can add support through subclassing::
python, official-docs, cpython, P0
Local_Trusted_Corpus
b4ab70e2-360a-4df5-ab59-abb26f3041e8
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,788
supabase-export-v2
81059d02daee750b
Extension types can easily be made to support weak references; see :ref:`weakref-support`. When ``__slots__`` are defined for a given type, weak reference support is disabled unless a ``'__weakref__'`` string is also present in the sequence of strings in the ``__slots__`` declaration. See :ref:`__slots__ documentation ...
trusted_official_docs
CPython Docs
Extension types can easily be made to support weak references; see :ref:`weakref-support`. When ``__slots__`` are defined for a given type, weak reference support is disabled unless a ``'__weakref__'`` string is also present in the sequence of strings in the ``__slots__`` declaration. See :ref:`__slots__ documentation ...
Extension types can easily be made to support weak references; see :ref:`weakref-support`. When ``__slots__`` are defined for a given type, weak reference support is disabled unless a ``'__weakref__'`` string is also present in the sequence of strings in the ``__slots__`` declaration. See :ref:`__slots__ documentation ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b60f509d-5647-4328-9122-277daadb2665
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,794
supabase-export-v2
9a03812de8f8ff22
value even after the *object* was deleted. If :func:`hash` is called the first time only after the *object* was deleted, the call will raise :exc:`TypeError`. Weak references support tests for equality, but not ordering. If the referents are still alive, two references have the same equality relationship as their ref...
trusted_official_docs
CPython Docs
value even after the *object* was deleted. If :func:`hash` is called the first time only after the *object* was deleted, the call will raise :exc:`TypeError`. Weak references support tests for equality, but not ordering. If the referents are still alive, two references have the same equality relationship as their ref...
value even after the *object* was deleted. If :func:`hash` is called the first time only after the *object* was deleted, the call will raise :exc:`TypeError`. Weak references support tests for equality, but not ordering. If the referents are still alive, two references have the same equality relationship as their ref...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b6df9426-9179-4a00-84eb-c74d8baeb592
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,802
supabase-export-v2
da557fa766257a83
Accessing an attribute of the proxy object after the referent is garbage collected raises :exc:`ReferenceError`. .. versionchanged:: 3.8 Extended the operator support on proxy objects to include the matrix multiplication operators ``@`` and ``@=``.
trusted_official_docs
CPython Docs
Accessing an attribute of the proxy object after the referent is garbage collected raises :exc:`ReferenceError`. .. versionchanged:: 3.8 Extended the operator support on proxy objects to include the matrix multiplication operators ``@`` and ``@=``.
Accessing an attribute of the proxy object after the referent is garbage collected raises :exc:`ReferenceError`. .. versionchanged:: 3.8 Extended the operator support on proxy objects to include the matrix multiplication operators ``@`` and ``@=``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
b95db619-35b7-4097-bfe5-9ebbaf292dfc
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,798
supabase-export-v2
812d2b228053fe16
the weakref. If there is no callback or if the referent of the weakref is no longer alive then this attribute will have value ``None``. .. versionchanged:: 3.4 Added the :attr:`__callback__` attribute.
trusted_official_docs
CPython Docs
the weakref. If there is no callback or if the referent of the weakref is no longer alive then this attribute will have value ``None``. .. versionchanged:: 3.4 Added the :attr:`__callback__` attribute.
the weakref. If there is no callback or if the referent of the weakref is no longer alive then this attribute will have value ``None``. .. versionchanged:: 3.4 Added the :attr:`__callback__` attribute.
python, official-docs, cpython, P0
Local_Trusted_Corpus
bc785ed7-ca8e-443c-911e-d5bafd94e23f
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,801
supabase-export-v2
f72b1e16c4b0fd82
fundamentally mutable nature, and prevents their use as dictionary keys. *callback* is the same as the parameter of the same name to the :func:`ref` function. Accessing an attribute of the proxy object after the referent is garbage collected raises :exc:`ReferenceError`.
trusted_official_docs
CPython Docs
fundamentally mutable nature, and prevents their use as dictionary keys. *callback* is the same as the parameter of the same name to the :func:`ref` function. Accessing an attribute of the proxy object after the referent is garbage collected raises :exc:`ReferenceError`.
fundamentally mutable nature, and prevents their use as dictionary keys. *callback* is the same as the parameter of the same name to the :func:`ref` function. Accessing an attribute of the proxy object after the referent is garbage collected raises :exc:`ReferenceError`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
bce6792a-e57d-46d5-ba20-b1a68d20b642
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,867
supabase-export-v2
48774c90ac6cefc7
weak reference to become invalidated before the weak reference is called; the idiom shown above is safe in threaded applications as well as single-threaded applications. Specialized versions of :class:`ref` objects can be created through subclassing. This is used in the implementation of the :class:`WeakValueDictionary...
trusted_official_docs
CPython Docs
weak reference to become invalidated before the weak reference is called; the idiom shown above is safe in threaded applications as well as single-threaded applications. Specialized versions of :class:`ref` objects can be created through subclassing. This is used in the implementation of the :class:`WeakValueDictionary...
weak reference to become invalidated before the weak reference is called; the idiom shown above is safe in threaded applications as well as single-threaded applications. Specialized versions of :class:`ref` objects can be created through subclassing. This is used in the implementation of the :class:`WeakValueDictionary...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c103df41-abf4-4bf2-b1f3-6fd5bbb49c9b
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,780
supabase-export-v2
b69a0db83a42174f
not usually necessary to create your own weak references directly. The low-level machinery is exposed by the :mod:`!weakref` module for the benefit of advanced uses. Not all objects can be weakly referenced. Objects which support weak references include class instances, functions written in Python (but not in C), insta...
trusted_official_docs
CPython Docs
not usually necessary to create your own weak references directly. The low-level machinery is exposed by the :mod:`!weakref` module for the benefit of advanced uses. Not all objects can be weakly referenced. Objects which support weak references include class instances, functions written in Python (but not in C), insta...
not usually necessary to create your own weak references directly. The low-level machinery is exposed by the :mod:`!weakref` module for the benefit of advanced uses. Not all objects can be weakly referenced. Objects which support weak references include class instances, functions written in Python (but not in C), insta...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c498789b-c5fa-48b9-a2f6-4d4935988250
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,886
supabase-export-v2
f147b597555e1355
{'z': 3}) >>> newobj, func, args, kwargs = _ >>> assert not f.alive >>> assert newobj is obj >>> assert func(*args, **kwargs) == 6 CALLBACK Unless you set the :attr:`~finalize.atexit` attribute to :const:`False`, a finalizer will be called when the program exits if it is still alive. For instance
trusted_official_docs
CPython Docs
{'z': 3}) >>> newobj, func, args, kwargs = _ >>> assert not f.alive >>> assert newobj is obj >>> assert func(*args, **kwargs) == 6 CALLBACK Unless you set the :attr:`~finalize.atexit` attribute to :const:`False`, a finalizer will be called when the program exits if it is still alive. For instance
{'z': 3}) >>> newobj, func, args, kwargs = _ >>> assert not f.alive >>> assert newobj is obj >>> assert func(*args, **kwargs) == 6 CALLBACK Unless you set the :attr:`~finalize.atexit` attribute to :const:`False`, a finalizer will be called when the program exits if it is still alive. For instance
python, official-docs, cpython, P0
Local_Trusted_Corpus
c6bd3626-25f8-45f8-8d6a-4da5d1028ec7
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,813
supabase-export-v2
4f6d74c538efb9b5
# d = {k1: 1} >>> del d[k1] >>> d[k2] = 2 # d = {k2: 2} >>> del k1 # d = {k2: 2} .. versionchanged:: 3.9 Added support for ``|`` and ``|=`` operators, as specified in :pep:`584`.
trusted_official_docs
CPython Docs
# d = {k1: 1} >>> del d[k1] >>> d[k2] = 2 # d = {k2: 2} >>> del k1 # d = {k2: 2} .. versionchanged:: 3.9 Added support for ``|`` and ``|=`` operators, as specified in :pep:`584`.
# d = {k1: 1} >>> del d[k1] >>> d[k2] = 2 # d = {k2: 2} >>> del k1 # d = {k2: 2} .. versionchanged:: 3.9 Added support for ``|`` and ``|=`` operators, as specified in :pep:`584`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
c8dc33d1-137c-4614-80f6-a17efeba2886
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,828
supabase-export-v2
a68efed9abe5a44f
= weakref.WeakMethod(c.method) >>> r() <bound method C.method of <__main__.C object at 0x7fc859830220>> >>> r()() method called! >>> del c >>> gc.collect() 0 >>> r() >>> *callback* is the same as the parameter of the same name to the :func:`ref` function.
trusted_official_docs
CPython Docs
= weakref.WeakMethod(c.method) >>> r() <bound method C.method of <__main__.C object at 0x7fc859830220>> >>> r()() method called! >>> del c >>> gc.collect() 0 >>> r() >>> *callback* is the same as the parameter of the same name to the :func:`ref` function.
= weakref.WeakMethod(c.method) >>> r() <bound method C.method of <__main__.C object at 0x7fc859830220>> >>> r()() method called! >>> del c >>> gc.collect() 0 >>> r() >>> *callback* is the same as the parameter of the same name to the :func:`ref` function.
python, official-docs, cpython, P0
Local_Trusted_Corpus
ccc62c80-87b0-43fc-a2b6-fa6fcddaf255
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,812
supabase-export-v2
495733d2f0a5bf0c
A workaround would be to remove the key prior to reassignment:: >>> class T(str): pass ... >>> k1, k2 = T(), T() >>> d = weakref.WeakKeyDictionary() >>> d[k1] = 1 # d = {k1: 1} >>> del d[k1] >>> d[k2] = 2 # d = {k2: 2} >>> del k1 # d = {k2: 2}
trusted_official_docs
CPython Docs
A workaround would be to remove the key prior to reassignment:: >>> class T(str): pass ... >>> k1, k2 = T(), T() >>> d = weakref.WeakKeyDictionary() >>> d[k1] = 1 # d = {k1: 1} >>> del d[k1] >>> d[k2] = 2 # d = {k2: 2} >>> del k1 # d = {k2: 2}
A workaround would be to remove the key prior to reassignment:: >>> class T(str): pass ... >>> k1, k2 = T(), T() >>> d = weakref.WeakKeyDictionary() >>> d[k1] = 1 # d = {k1: 1} >>> del d[k1] >>> d[k2] = 2 # d = {k2: 2} >>> del k1 # d = {k2: 2}
python, official-docs, cpython, P0
Local_Trusted_Corpus
cec0280a-c2de-49fe-9289-f029b5c620a1
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,790
supabase-export-v2
8eb54dcd59349046
.. class:: ref(object[, callback]) Return a weak reference to *object*. The original object can be retrieved by calling the reference object if the referent is still alive; if the referent is no longer alive, calling the reference object will cause :const:`None` to be returned. If *callback* is provided and not :con...
trusted_official_docs
CPython Docs
.. class:: ref(object[, callback]) Return a weak reference to *object*. The original object can be retrieved by calling the reference object if the referent is still alive; if the referent is no longer alive, calling the reference object will cause :const:`None` to be returned. If *callback* is provided and not :con...
.. class:: ref(object[, callback]) Return a weak reference to *object*. The original object can be retrieved by calling the reference object if the referent is still alive; if the referent is no longer alive, calling the reference object will cause :const:`None` to be returned. If *callback* is provided and not :con...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d193cca2-7987-4ce5-abd2-af468dd8fc88
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,814
supabase-export-v2
00076491fb5d90a5
.. versionchanged:: 3.9 Added support for ``|`` and ``|=`` operators, as specified in :pep:`584`. :class:`WeakKeyDictionary` objects have an additional method that exposes the internal references directly. The references are not guaranteed to be "live" at the time they are used, so the result of calling the references ...
trusted_official_docs
CPython Docs
.. versionchanged:: 3.9 Added support for ``|`` and ``|=`` operators, as specified in :pep:`584`. :class:`WeakKeyDictionary` objects have an additional method that exposes the internal references directly. The references are not guaranteed to be "live" at the time they are used, so the result of calling the references ...
.. versionchanged:: 3.9 Added support for ``|`` and ``|=`` operators, as specified in :pep:`584`. :class:`WeakKeyDictionary` objects have an additional method that exposes the internal references directly. The references are not guaranteed to be "live" at the time they are used, so the result of calling the references ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d9a3cdd7-4dd8-4dc3-a280-032f369022fc
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,834
supabase-export-v2
4bca9db560173eab
output, but cannot be propagated. They are handled in the same way as exceptions raised from an object's :meth:`~object.__del__` method or a weak reference's callback. When the program exits, each remaining live finalizer is called unless its :attr:`atexit` attribute has been set to false. They are called in reverse ...
trusted_official_docs
CPython Docs
output, but cannot be propagated. They are handled in the same way as exceptions raised from an object's :meth:`~object.__del__` method or a weak reference's callback. When the program exits, each remaining live finalizer is called unless its :attr:`atexit` attribute has been set to false. They are called in reverse ...
output, but cannot be propagated. They are handled in the same way as exceptions raised from an object's :meth:`~object.__del__` method or a weak reference's callback. When the program exits, each remaining live finalizer is called unless its :attr:`atexit` attribute has been set to false. They are called in reverse ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
dcffb41e-efe9-4572-a70c-d797b1bf7347
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,781
supabase-export-v2
570b3c083d571d62
in C), instance methods, sets, frozensets, some :term:`file objects <file object>`, :term:`generators <generator>`, type objects, sockets, arrays, deques, regular expression pattern objects, and code objects. .. versionchanged:: 3.2 Added support for thread.lock, threading.Lock, and code objects.
trusted_official_docs
CPython Docs
in C), instance methods, sets, frozensets, some :term:`file objects <file object>`, :term:`generators <generator>`, type objects, sockets, arrays, deques, regular expression pattern objects, and code objects. .. versionchanged:: 3.2 Added support for thread.lock, threading.Lock, and code objects.
in C), instance methods, sets, frozensets, some :term:`file objects <file object>`, :term:`generators <generator>`, type objects, sockets, arrays, deques, regular expression pattern objects, and code objects. .. versionchanged:: 3.2 Added support for thread.lock, threading.Lock, and code objects.
python, official-docs, cpython, P0
Local_Trusted_Corpus
e4513dcd-2bdb-42f1-8c3c-b7263673c61e
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,890
supabase-export-v2
211fd3b8815e7ba2
Comparing finalizers with :meth:`~object.__del__` methods --------------------------------------------------------- Suppose we want to create a class whose instances represent temporary directories. The directories should be deleted with their contents when the first of the following events occurs:
trusted_official_docs
CPython Docs
Comparing finalizers with :meth:`~object.__del__` methods --------------------------------------------------------- Suppose we want to create a class whose instances represent temporary directories. The directories should be deleted with their contents when the first of the following events occurs:
Comparing finalizers with :meth:`~object.__del__` methods --------------------------------------------------------- Suppose we want to create a class whose instances represent temporary directories. The directories should be deleted with their contents when the first of the following events occurs:
python, official-docs, cpython, P0
Local_Trusted_Corpus
e7b9361d-13b5-44d7-a1b2-5925962919be
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,907
supabase-export-v2
68f967a93f4e22aa
.. note:: If you create a finalizer object in a daemonic thread just as the program exits then there is the possibility that the finalizer does not get called at exit. However, in a daemonic thread :func:`atexit.register`, ``try: ... finally: ...`` and ``with: ...`` do not guarantee that cleanup occurs either.
trusted_official_docs
CPython Docs
.. note:: If you create a finalizer object in a daemonic thread just as the program exits then there is the possibility that the finalizer does not get called at exit. However, in a daemonic thread :func:`atexit.register`, ``try: ... finally: ...`` and ``with: ...`` do not guarantee that cleanup occurs either.
.. note:: If you create a finalizer object in a daemonic thread just as the program exits then there is the possibility that the finalizer does not get called at exit. However, in a daemonic thread :func:`atexit.register`, ``try: ... finally: ...`` and ``with: ...`` do not guarantee that cleanup occurs either.
python, official-docs, cpython, P0
Local_Trusted_Corpus
ebaa6ff0-dac9-4909-8d08-59118e6b1ba8
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,832
supabase-export-v2
cf16dbbab7cd1ef6
when *obj* is garbage collected. Unlike an ordinary weak reference, a finalizer will always survive until the reference object is collected, greatly simplifying lifecycle management. A finalizer is considered *alive* until it is called (either explicitly or at garbage collection), and after that it is *dead*. Calling ...
trusted_official_docs
CPython Docs
when *obj* is garbage collected. Unlike an ordinary weak reference, a finalizer will always survive until the reference object is collected, greatly simplifying lifecycle management. A finalizer is considered *alive* until it is called (either explicitly or at garbage collection), and after that it is *dead*. Calling ...
when *obj* is garbage collected. Unlike an ordinary weak reference, a finalizer will always survive until the reference object is collected, greatly simplifying lifecycle management. A finalizer is considered *alive* until it is called (either explicitly or at garbage collection), and after that it is *dead*. Calling ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ecb6ba7f-18e9-4a58-9242-5ce27a6a7c48
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,866
supabase-export-v2
2ff80b89784c6535
o = r() if o is None: # referent has been garbage collected print("Object has been deallocated; can't frobnicate.") else: print("Object is still live!") o.do_something_useful() Using a separate test for "liveness" creates race conditions in threaded applications; another thread can cause a weak reference to become inva...
trusted_official_docs
CPython Docs
o = r() if o is None: # referent has been garbage collected print("Object has been deallocated; can't frobnicate.") else: print("Object is still live!") o.do_something_useful() Using a separate test for "liveness" creates race conditions in threaded applications; another thread can cause a weak reference to become inva...
o = r() if o is None: # referent has been garbage collected print("Object has been deallocated; can't frobnicate.") else: print("Object is still live!") o.do_something_useful() Using a separate test for "liveness" creates race conditions in threaded applications; another thread can cause a weak reference to become inva...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f24eb155-f123-42e4-a224-d31f2bb7b1cb
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,831
supabase-export-v2
9858526fdde03d64
.. class:: finalize(obj, func, /, *args, **kwargs) Return a callable finalizer object which will be called when *obj* is garbage collected. Unlike an ordinary weak reference, a finalizer will always survive until the reference object is collected, greatly simplifying lifecycle management.
trusted_official_docs
CPython Docs
.. class:: finalize(obj, func, /, *args, **kwargs) Return a callable finalizer object which will be called when *obj* is garbage collected. Unlike an ordinary weak reference, a finalizer will always survive until the reference object is collected, greatly simplifying lifecycle management.
.. class:: finalize(obj, func, /, *args, **kwargs) Return a callable finalizer object which will be called when *obj* is garbage collected. Unlike an ordinary weak reference, a finalizer will always survive until the reference object is collected, greatly simplifying lifecycle management.
python, official-docs, cpython, P0
Local_Trusted_Corpus
f251077d-162f-4d59-9fb8-4c4dd7424659
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,861
supabase-export-v2
0969bb6a3db254be
have no methods and no attributes besides :attr:`ref.__callback__`. A weak reference object allows the referent to be obtained, if it still exists, by calling it: >>> import weakref >>> class Object: ... pass ... >>> o = Object() >>> r = weakref.ref(o) >>> o2 = r() >>> o is o2 True
trusted_official_docs
CPython Docs
have no methods and no attributes besides :attr:`ref.__callback__`. A weak reference object allows the referent to be obtained, if it still exists, by calling it: >>> import weakref >>> class Object: ... pass ... >>> o = Object() >>> r = weakref.ref(o) >>> o2 = r() >>> o is o2 True
have no methods and no attributes besides :attr:`ref.__callback__`. A weak reference object allows the referent to be obtained, if it still exists, by calling it: >>> import weakref >>> class Object: ... pass ... >>> o = Object() >>> r = weakref.ref(o) >>> o2 = r() >>> o is o2 True
python, official-docs, cpython, P0
Local_Trusted_Corpus
f3b29ec5-4c66-461f-ab7c-7b5139076d13
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,871
supabase-export-v2
1f2089ef22a84e08
class ExtendedRef(weakref.ref): def __init__(self, ob, callback=None, /, **annotations): super().__init__(ob, callback) self.__counter = 0 for k, v in annotations.items(): setattr(self, k, v) def __call__(self): """Return a pair containing the referent and the number of times the reference has been called. """ ob = ...
trusted_official_docs
CPython Docs
class ExtendedRef(weakref.ref): def __init__(self, ob, callback=None, /, **annotations): super().__init__(ob, callback) self.__counter = 0 for k, v in annotations.items(): setattr(self, k, v) def __call__(self): """Return a pair containing the referent and the number of times the reference has been called. """ ob = ...
class ExtendedRef(weakref.ref): def __init__(self, ob, callback=None, /, **annotations): super().__init__(ob, callback) self.__counter = 0 for k, v in annotations.items(): setattr(self, k, v) def __call__(self): """Return a pair containing the referent and the number of times the reference has been called. """ ob = ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
fa6521f4-793e-4b64-99ea-bf3109812c36
CPython Docs
file://datasets/cpython/Doc/library/weakref.rst
unknown
a06c2335-159a-49c4-91bc-324c62efae7d
16,811
supabase-export-v2
39ea4e414b2b99c6
>>> d[k1] = 1 # d = {k1: 1} >>> d[k2] = 2 # d = {k1: 2} >>> del k1 # d = {} A workaround would be to remove the key prior to reassignment::
trusted_official_docs
CPython Docs
>>> d[k1] = 1 # d = {k1: 1} >>> d[k2] = 2 # d = {k1: 2} >>> del k1 # d = {} A workaround would be to remove the key prior to reassignment::
>>> d[k1] = 1 # d = {k1: 1} >>> d[k2] = 2 # d = {k1: 2} >>> del k1 # d = {} A workaround would be to remove the key prior to reassignment::
python, official-docs, cpython, P0
Local_Trusted_Corpus
041df575-06b9-42b7-a0a8-20ab67d634d7
CPython Docs
file://datasets/cpython/Doc/library/selectors.rst
unknown
6c851f62-9288-4630-804e-dd5ba8894175
16,943
supabase-export-v2
9746c0d80e45764b
This is equivalent to ``BaseSelector.unregister(fileobj)`` followed by ``BaseSelector.register(fileobj, events, data)``, except that it can be implemented more efficiently. This returns a new :class:`SelectorKey` instance, or raises a :exc:`ValueError` in case of invalid event mask or file descriptor, or :exc:`KeyErr...
trusted_official_docs
CPython Docs
This is equivalent to ``BaseSelector.unregister(fileobj)`` followed by ``BaseSelector.register(fileobj, events, data)``, except that it can be implemented more efficiently. This returns a new :class:`SelectorKey` instance, or raises a :exc:`ValueError` in case of invalid event mask or file descriptor, or :exc:`KeyErr...
This is equivalent to ``BaseSelector.unregister(fileobj)`` followed by ``BaseSelector.register(fileobj, events, data)``, except that it can be implemented more efficiently. This returns a new :class:`SelectorKey` instance, or raises a :exc:`ValueError` in case of invalid event mask or file descriptor, or :exc:`KeyErr...
python, official-docs, cpython, P0
Local_Trusted_Corpus
16d411eb-a3b4-4428-b7ca-e88d3a563407
CPython Docs
file://datasets/cpython/Doc/library/selectors.rst
unknown
6c851f62-9288-4630-804e-dd5ba8894175
16,940
supabase-export-v2
05ace573bf80c45c
not registered. It will raise :exc:`ValueError` if *fileobj* is invalid (e.g. it has no ``fileno()`` method or its ``fileno()`` method has an invalid return value). .. method:: modify(fileobj, events, data=None)
trusted_official_docs
CPython Docs
not registered. It will raise :exc:`ValueError` if *fileobj* is invalid (e.g. it has no ``fileno()`` method or its ``fileno()`` method has an invalid return value). .. method:: modify(fileobj, events, data=None)
not registered. It will raise :exc:`ValueError` if *fileobj* is invalid (e.g. it has no ``fileno()`` method or its ``fileno()`` method has an invalid return value). .. method:: modify(fileobj, events, data=None)
python, official-docs, cpython, P0
Local_Trusted_Corpus
17ca2ec6-c710-4f38-9304-6be988b336a2
CPython Docs
file://datasets/cpython/Doc/library/selectors.rst
unknown
6c851f62-9288-4630-804e-dd5ba8894175
16,914
supabase-export-v2
81b023ccd5dd77fb
multiplexing, built upon the :mod:`select` module primitives. Users are encouraged to use this module instead, unless they want precise control over the OS-level primitives used. It defines a :class:`BaseSelector` abstract base class, along with several concrete implementations (:class:`KqueueSelector`, :class:`EpollSe...
trusted_official_docs
CPython Docs
multiplexing, built upon the :mod:`select` module primitives. Users are encouraged to use this module instead, unless they want precise control over the OS-level primitives used. It defines a :class:`BaseSelector` abstract base class, along with several concrete implementations (:class:`KqueueSelector`, :class:`EpollSe...
multiplexing, built upon the :mod:`select` module primitives. Users are encouraged to use this module instead, unless they want precise control over the OS-level primitives used. It defines a :class:`BaseSelector` abstract base class, along with several concrete implementations (:class:`KqueueSelector`, :class:`EpollSe...
python, official-docs, cpython, P0
Local_Trusted_Corpus
28e0b152-b5ad-448a-9b82-29b7168cf4b9
CPython Docs
file://datasets/cpython/Doc/library/selectors.rst
unknown
6c851f62-9288-4630-804e-dd5ba8894175
16,916
supabase-export-v2
5a64f2fb91eb7d44
:class:`DefaultSelector` is an alias to the most efficient implementation available on the current platform: this should be the default choice for most users. .. note:: The type of file objects supported depends on the platform: on Windows, sockets are supported, but not pipes, whereas on Unix, both are supported (s...
trusted_official_docs
CPython Docs
:class:`DefaultSelector` is an alias to the most efficient implementation available on the current platform: this should be the default choice for most users. .. note:: The type of file objects supported depends on the platform: on Windows, sockets are supported, but not pipes, whereas on Unix, both are supported (s...
:class:`DefaultSelector` is an alias to the most efficient implementation available on the current platform: this should be the default choice for most users. .. note:: The type of file objects supported depends on the platform: on Windows, sockets are supported, but not pipes, whereas on Unix, both are supported (s...
python, official-docs, cpython, P0
Local_Trusted_Corpus
2d8e086e-d276-4db4-8d1e-389d00ae5a56
CPython Docs
file://datasets/cpython/Doc/library/selectors.rst
unknown
6c851f62-9288-4630-804e-dd5ba8894175
16,913
supabase-export-v2
eb103f9b9f003d36
Introduction ------------ This module allows high-level and efficient I/O multiplexing, built upon the :mod:`select` module primitives. Users are encouraged to use this module instead, unless they want precise control over the OS-level primitives used.
trusted_official_docs
CPython Docs
Introduction ------------ This module allows high-level and efficient I/O multiplexing, built upon the :mod:`select` module primitives. Users are encouraged to use this module instead, unless they want precise control over the OS-level primitives used.
Introduction ------------ This module allows high-level and efficient I/O multiplexing, built upon the :mod:`select` module primitives. Users are encouraged to use this module instead, unless they want precise control over the OS-level primitives used.
python, official-docs, cpython, P0
Local_Trusted_Corpus
346414d3-2677-473c-932e-951f4d4d047e
CPython Docs
file://datasets/cpython/Doc/library/selectors.rst
unknown
6c851f62-9288-4630-804e-dd5ba8894175
16,934
supabase-export-v2
53b8a5b5f3ff6a38
Register a file object for selection, monitoring it for I/O events. *fileobj* is the file object to monitor. It may either be an integer file descriptor or an object with a ``fileno()`` method. *events* is a bitwise mask of events to monitor. *data* is an opaque object.
trusted_official_docs
CPython Docs
Register a file object for selection, monitoring it for I/O events. *fileobj* is the file object to monitor. It may either be an integer file descriptor or an object with a ``fileno()`` method. *events* is a bitwise mask of events to monitor. *data* is an opaque object.
Register a file object for selection, monitoring it for I/O events. *fileobj* is the file object to monitor. It may either be an integer file descriptor or an object with a ``fileno()`` method. *events* is a bitwise mask of events to monitor. *data* is an opaque object.
python, official-docs, cpython, P0
Local_Trusted_Corpus
402fb80d-49b1-4080-8119-4e1651f772aa
CPython Docs
file://datasets/cpython/Doc/library/selectors.rst
unknown
6c851f62-9288-4630-804e-dd5ba8894175
16,915
supabase-export-v2
68f9d4088ec9822e
on multiple file objects. In the following, "file object" refers to any object with a :meth:`~io.IOBase.fileno` method, or a raw file descriptor. See :term:`file object`. :class:`DefaultSelector` is an alias to the most efficient implementation available on the current platform: this should be the default choice for mo...
trusted_official_docs
CPython Docs
on multiple file objects. In the following, "file object" refers to any object with a :meth:`~io.IOBase.fileno` method, or a raw file descriptor. See :term:`file object`. :class:`DefaultSelector` is an alias to the most efficient implementation available on the current platform: this should be the default choice for mo...
on multiple file objects. In the following, "file object" refers to any object with a :meth:`~io.IOBase.fileno` method, or a raw file descriptor. See :term:`file object`. :class:`DefaultSelector` is an alias to the most efficient implementation available on the current platform: this should be the default choice for mo...
python, official-docs, cpython, P0
Local_Trusted_Corpus
5633679d-9edc-46a2-806c-684bdaa3ccdb
CPython Docs
file://datasets/cpython/Doc/library/selectors.rst
unknown
6c851f62-9288-4630-804e-dd5ba8894175
16,923
supabase-export-v2
7488cf10f530cfe2
bitwise mask indicating which I/O events should be waited for on a given file object. It can be a combination of the module's constants below: +-----------------------+-----------------------------------------------+ | Constant | Meaning | +=======================+===============================================+ | ....
trusted_official_docs
CPython Docs
bitwise mask indicating which I/O events should be waited for on a given file object. It can be a combination of the module's constants below: +-----------------------+-----------------------------------------------+ | Constant | Meaning | +=======================+===============================================+ | ....
bitwise mask indicating which I/O events should be waited for on a given file object. It can be a combination of the module's constants below: +-----------------------+-----------------------------------------------+ | Constant | Meaning | +=======================+===============================================+ | ....
python, official-docs, cpython, P0
Local_Trusted_Corpus
6b7b0e2c-3f4f-4f89-88b3-c54c9492b6b9
CPython Docs
file://datasets/cpython/Doc/library/selectors.rst
unknown
6c851f62-9288-4630-804e-dd5ba8894175
16,947
supabase-export-v2
19173dae719a6f5c
won't block, and will report the currently ready file objects. If *timeout* is ``None``, the call will block until a monitored file object becomes ready. This returns a list of ``(key, events)`` tuples, one for each ready file object.
trusted_official_docs
CPython Docs
won't block, and will report the currently ready file objects. If *timeout* is ``None``, the call will block until a monitored file object becomes ready. This returns a list of ``(key, events)`` tuples, one for each ready file object.
won't block, and will report the currently ready file objects. If *timeout* is ``None``, the call will block until a monitored file object becomes ready. This returns a list of ``(key, events)`` tuples, one for each ready file object.
python, official-docs, cpython, P0
Local_Trusted_Corpus