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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3dd82b70-041e-4245-b477-abc13ce5bdbb | CPython Docs | file://datasets/cpython/Doc/library/stat.rst | unknown | a95078fb-55de-4fa8-b2dc-e2cdf3b7ae3a | 8,974 | supabase-export-v2 | 6e4ce0a8330060ea | .. function:: S_IMODE(mode)
Return the portion of the file's mode that can be set by
:func:`os.chmod`\ ---that is, the file's permission bits, plus the sticky
bit, set-group-id, and set-user-id bits (on systems that support them). | trusted_official_docs | CPython Docs | .. function:: S_IMODE(mode)
Return the portion of the file's mode that can be set by
:func:`os.chmod`\ ---that is, the file's permission bits, plus the sticky
bit, set-group-id, and set-user-id bits (on systems that support them). | .. function:: S_IMODE(mode)
Return the portion of the file's mode that can be set by
:func:`os.chmod`\ ---that is, the file's permission bits, plus the sticky
bit, set-group-id, and set-user-id bits (on systems that support them). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
47faaa91-f4a0-44ea-801c-1cabd7060f4f | CPython Docs | file://datasets/cpython/Doc/library/stat.rst | unknown | a95078fb-55de-4fa8-b2dc-e2cdf3b7ae3a | 9,053 | supabase-export-v2 | 9c0c7fa8ec8e0446 | when testing bits in the ``st_file_attributes`` member returned by :func:`os.stat`. See the `Windows API documentation <https://msdn.microsoft.com/en-us/library/windows/desktop/gg258117.aspx>`_ for more detail on the meaning of these constants.
.. data:: FILE_ATTRIBUTE_ARCHIVE
FILE_ATTRIBUTE_COMPRESSED
FILE_ATTRIBUTE... | trusted_official_docs | CPython Docs | when testing bits in the ``st_file_attributes`` member returned by :func:`os.stat`. See the `Windows API documentation <https://msdn.microsoft.com/en-us/library/windows/desktop/gg258117.aspx>`_ for more detail on the meaning of these constants.
.. data:: FILE_ATTRIBUTE_ARCHIVE
FILE_ATTRIBUTE_COMPRESSED
FILE_ATTRIBUTE... | when testing bits in the ``st_file_attributes`` member returned by :func:`os.stat`. See the `Windows API documentation <https://msdn.microsoft.com/en-us/library/windows/desktop/gg258117.aspx>`_ for more detail on the meaning of these constants.
.. data:: FILE_ATTRIBUTE_ARCHIVE
FILE_ATTRIBUTE_COMPRESSED
FILE_ATTRIBUTE... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5455cc5e-6ff2-4567-8bea-5d2ab830539b | CPython Docs | file://datasets/cpython/Doc/library/stat.rst | unknown | a95078fb-55de-4fa8-b2dc-e2cdf3b7ae3a | 9,008 | supabase-export-v2 | 41a96f589ed1b286 | .. data:: S_ENFMT
System V file locking enforcement. This flag is shared with :data:`S_ISGID`:
file/record locking is enforced on files that do not have the group
execution bit (:data:`S_IXGRP`) set. | trusted_official_docs | CPython Docs | .. data:: S_ENFMT
System V file locking enforcement. This flag is shared with :data:`S_ISGID`:
file/record locking is enforced on files that do not have the group
execution bit (:data:`S_IXGRP`) set. | .. data:: S_ENFMT
System V file locking enforcement. This flag is shared with :data:`S_ISGID`:
file/record locking is enforced on files that do not have the group
execution bit (:data:`S_IXGRP`) set. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
610bde7a-ce61-4e2d-809b-d7f46f4abd36 | CPython Docs | file://datasets/cpython/Doc/library/stat.rst | unknown | a95078fb-55de-4fa8-b2dc-e2cdf3b7ae3a | 9,000 | supabase-export-v2 | 80cba461f852095e | .. data:: S_ISGID
Set-group-ID bit. This bit has several special uses. For a directory
it indicates that BSD semantics is to be used for that directory:
files created there inherit their group ID from the directory, not
from the effective group ID of the creating process, and directories
created there will also get... | trusted_official_docs | CPython Docs | .. data:: S_ISGID
Set-group-ID bit. This bit has several special uses. For a directory
it indicates that BSD semantics is to be used for that directory:
files created there inherit their group ID from the directory, not
from the effective group ID of the creating process, and directories
created there will also get... | .. data:: S_ISGID
Set-group-ID bit. This bit has several special uses. For a directory
it indicates that BSD semantics is to be used for that directory:
files created there inherit their group ID from the directory, not
from the effective group ID of the creating process, and directories
created there will also get... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6dd8eca0-47c2-4eee-98b3-5f56a86be636 | CPython Docs | file://datasets/cpython/Doc/library/stat.rst | unknown | a95078fb-55de-4fa8-b2dc-e2cdf3b7ae3a | 8,992 | supabase-export-v2 | bd82cd55d60920c0 | .. data:: ST_CTIME
The "ctime" as reported by the operating system. On some systems (like Unix) is
the time of the last metadata change, and, on others (like Windows), is the
creation time (see platform documentation for details). | trusted_official_docs | CPython Docs | .. data:: ST_CTIME
The "ctime" as reported by the operating system. On some systems (like Unix) is
the time of the last metadata change, and, on others (like Windows), is the
creation time (see platform documentation for details). | .. data:: ST_CTIME
The "ctime" as reported by the operating system. On some systems (like Unix) is
the time of the last metadata change, and, on others (like Windows), is the
creation time (see platform documentation for details). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
87057756-6d23-4ceb-8bf2-19ba6c759708 | CPython Docs | file://datasets/cpython/Doc/library/stat.rst | unknown | a95078fb-55de-4fa8-b2dc-e2cdf3b7ae3a | 8,948 | supabase-export-v2 | 2fd26ffd25a8763f | results of :func:`os.stat`, :func:`os.fstat` and :func:`os.lstat` (if they exist). For complete details about the :c:func:`stat`, :c:func:`!fstat` and :c:func:`!lstat` calls, consult the documentation for your system.
.. versionchanged:: 3.4
The stat module is backed by a C implementation. | trusted_official_docs | CPython Docs | results of :func:`os.stat`, :func:`os.fstat` and :func:`os.lstat` (if they exist). For complete details about the :c:func:`stat`, :c:func:`!fstat` and :c:func:`!lstat` calls, consult the documentation for your system.
.. versionchanged:: 3.4
The stat module is backed by a C implementation. | results of :func:`os.stat`, :func:`os.fstat` and :func:`os.lstat` (if they exist). For complete details about the :c:func:`stat`, :c:func:`!fstat` and :c:func:`!lstat` calls, consult the documentation for your system.
.. versionchanged:: 3.4
The stat module is backed by a C implementation. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8eb3c0dc-f6f2-4108-8a80-ebab56494878 | CPython Docs | file://datasets/cpython/Doc/library/stat.rst | unknown | a95078fb-55de-4fa8-b2dc-e2cdf3b7ae3a | 9,052 | supabase-export-v2 | b7678ea38491801d | See the \*BSD or macOS systems man page :manpage:`chflags(2)` for more information.
On Windows, the following file attribute constants are available for use when
testing bits in the ``st_file_attributes`` member returned by :func:`os.stat`. See the `Windows API documentation
<https://msdn.microsoft.com/en-us/library/wi... | trusted_official_docs | CPython Docs | See the \*BSD or macOS systems man page :manpage:`chflags(2)` for more information.
On Windows, the following file attribute constants are available for use when
testing bits in the ``st_file_attributes`` member returned by :func:`os.stat`. See the `Windows API documentation
<https://msdn.microsoft.com/en-us/library/wi... | See the \*BSD or macOS systems man page :manpage:`chflags(2)` for more information.
On Windows, the following file attribute constants are available for use when
testing bits in the ``st_file_attributes`` member returned by :func:`os.stat`. See the `Windows API documentation
<https://msdn.microsoft.com/en-us/library/wi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9ce0d78c-195e-4625-a1ec-84118fcd66c1 | CPython Docs | file://datasets/cpython/Doc/library/stat.rst | unknown | a95078fb-55de-4fa8-b2dc-e2cdf3b7ae3a | 8,980 | supabase-export-v2 | e5f9ee2ef875fc4d | def walktree(top, callback): '''recursively descend the directory tree rooted at top, calling the callback function for each regular file'''
for f in os.listdir(top):
pathname = os.path.join(top, f)
mode = os.lstat(pathname).st_mode
if S_ISDIR(mode):
# It's a directory, recurse into it
walktree(pathname, callback)... | trusted_official_docs | CPython Docs | def walktree(top, callback): '''recursively descend the directory tree rooted at top, calling the callback function for each regular file'''
for f in os.listdir(top):
pathname = os.path.join(top, f)
mode = os.lstat(pathname).st_mode
if S_ISDIR(mode):
# It's a directory, recurse into it
walktree(pathname, callback)... | def walktree(top, callback): '''recursively descend the directory tree rooted at top, calling the callback function for each regular file'''
for f in os.listdir(top):
pathname = os.path.join(top, f)
mode = os.lstat(pathname).st_mode
if S_ISDIR(mode):
# It's a directory, recurse into it
walktree(pathname, callback)... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a7ee43cd-d793-4ea8-b7e0-2f6eb6ec1441 | CPython Docs | file://datasets/cpython/Doc/library/stat.rst | unknown | a95078fb-55de-4fa8-b2dc-e2cdf3b7ae3a | 8,993 | supabase-export-v2 | 9ec23e91d5a7f9c0 | systems (like Unix) is the time of the last metadata change, and, on others (like Windows), is the creation time (see platform documentation for details).
The interpretation of "file size" changes according to the file type. For plain
files this is the size of the file in bytes. For FIFOs and sockets under most
flavors... | trusted_official_docs | CPython Docs | systems (like Unix) is the time of the last metadata change, and, on others (like Windows), is the creation time (see platform documentation for details).
The interpretation of "file size" changes according to the file type. For plain
files this is the size of the file in bytes. For FIFOs and sockets under most
flavors... | systems (like Unix) is the time of the last metadata change, and, on others (like Windows), is the creation time (see platform documentation for details).
The interpretation of "file size" changes according to the file type. For plain
files this is the size of the file in bytes. For FIFOs and sockets under most
flavors... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c2721e2b-e21a-4272-8f2d-4599101b9664 | CPython Docs | file://datasets/cpython/Doc/library/stat.rst | unknown | a95078fb-55de-4fa8-b2dc-e2cdf3b7ae3a | 9,058 | supabase-export-v2 | 1f98e71bdc046083 | .. versionadded:: 3.8
On Linux, the following file attribute constants are available for use when
testing bits in the :attr:`~os.statx_result.stx_attributes` and
:attr:`~os.statx_result.stx_attributes_mask` members returned by
:func:`os.statx`. See the :manpage:`statx(2)` man page for more detail on the
meaning of thes... | trusted_official_docs | CPython Docs | .. versionadded:: 3.8
On Linux, the following file attribute constants are available for use when
testing bits in the :attr:`~os.statx_result.stx_attributes` and
:attr:`~os.statx_result.stx_attributes_mask` members returned by
:func:`os.statx`. See the :manpage:`statx(2)` man page for more detail on the
meaning of thes... | .. versionadded:: 3.8
On Linux, the following file attribute constants are available for use when
testing bits in the :attr:`~os.statx_result.stx_attributes` and
:attr:`~os.statx_result.stx_attributes_mask` members returned by
:func:`os.statx`. See the :manpage:`statx(2)` man page for more detail on the
meaning of thes... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cf3510fc-e985-4ff3-98b8-babf285503ad | CPython Docs | file://datasets/cpython/Doc/library/stat.rst | unknown | a95078fb-55de-4fa8-b2dc-e2cdf3b7ae3a | 8,977 | supabase-export-v2 | e7288023081e3d61 | Return the portion of the file's mode that describes the file type (used by the :func:`!S_IS\*` functions above).
Normally, you would use the :func:`!os.path.is\*` functions for testing the type
of a file; the functions here are useful when you are doing multiple tests of
the same file and wish to avoid the overhead of... | trusted_official_docs | CPython Docs | Return the portion of the file's mode that describes the file type (used by the :func:`!S_IS\*` functions above).
Normally, you would use the :func:`!os.path.is\*` functions for testing the type
of a file; the functions here are useful when you are doing multiple tests of
the same file and wish to avoid the overhead of... | Return the portion of the file's mode that describes the file type (used by the :func:`!S_IS\*` functions above).
Normally, you would use the :func:`!os.path.is\*` functions for testing the type
of a file; the functions here are useful when you are doing multiple tests of
the same file and wish to avoid the overhead of... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d388d57a-66e1-4568-8370-423e6e5c79e0 | CPython Docs | file://datasets/cpython/Doc/library/stat.rst | unknown | a95078fb-55de-4fa8-b2dc-e2cdf3b7ae3a | 8,998 | supabase-export-v2 | 30506acec86c146c | :data:`S_IFDOOR`, :data:`S_IFPORT` or :data:`S_IFWHT` are defined as 0 when the platform does not have support for the file types.
The following flags can also be used in the *mode* argument of :func:`os.chmod`: | trusted_official_docs | CPython Docs | :data:`S_IFDOOR`, :data:`S_IFPORT` or :data:`S_IFWHT` are defined as 0 when the platform does not have support for the file types.
The following flags can also be used in the *mode* argument of :func:`os.chmod`: | :data:`S_IFDOOR`, :data:`S_IFPORT` or :data:`S_IFWHT` are defined as 0 when the platform does not have support for the file types.
The following flags can also be used in the *mode* argument of :func:`os.chmod`: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e2aa651e-e6a8-4060-a864-52af87dd4d46 | CPython Docs | file://datasets/cpython/Doc/library/stat.rst | unknown | a95078fb-55de-4fa8-b2dc-e2cdf3b7ae3a | 8,994 | supabase-export-v2 | 69597f7e2f28fda1 | non-blocking open. The meaning of the size field for other character and block devices varies more, depending on the implementation of the underlying system call.
The variables below define the flags used in the :data:`ST_MODE` field. | trusted_official_docs | CPython Docs | non-blocking open. The meaning of the size field for other character and block devices varies more, depending on the implementation of the underlying system call.
The variables below define the flags used in the :data:`ST_MODE` field. | non-blocking open. The meaning of the size field for other character and block devices varies more, depending on the implementation of the underlying system call.
The variables below define the flags used in the :data:`ST_MODE` field. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e9e6368a-213e-4957-a72a-1221d1d126f5 | CPython Docs | file://datasets/cpython/Doc/library/stat.rst | unknown | a95078fb-55de-4fa8-b2dc-e2cdf3b7ae3a | 8,947 | supabase-export-v2 | 177de970c5ddf4eb | --------------
The :mod:`!stat` module defines constants and functions for interpreting the
results of :func:`os.stat`, :func:`os.fstat` and :func:`os.lstat` (if they
exist). For complete details about the :c:func:`stat`, :c:func:`!fstat` and
:c:func:`!lstat` calls, consult the documentation for your system. | trusted_official_docs | CPython Docs | --------------
The :mod:`!stat` module defines constants and functions for interpreting the
results of :func:`os.stat`, :func:`os.fstat` and :func:`os.lstat` (if they
exist). For complete details about the :c:func:`stat`, :c:func:`!fstat` and
:c:func:`!lstat` calls, consult the documentation for your system. | --------------
The :mod:`!stat` module defines constants and functions for interpreting the
results of :func:`os.stat`, :func:`os.fstat` and :func:`os.lstat` (if they
exist). For complete details about the :c:func:`stat`, :c:func:`!fstat` and
:c:func:`!lstat` calls, consult the documentation for your system. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
20ec1b21-9f4f-4670-83d6-335a1f585d08 | CPython Docs | file://datasets/cpython/Doc/library/distutils.rst | unknown | c553245c-cfcf-41a8-8096-72ea9b11554f | 9,065 | supabase-export-v2 | e1a1687ea0aa012c | library. It was :ref:`removed in Python 3.12 <whatsnew312-removed-distutils>` after being deprecated in Python 3.10. The removal was decided in :pep:`632`, which has `migration advice <https://peps.python.org/pep-0632/#migration-advice>`_.
The last version of Python that provided the :mod:`!distutils` module was
`Pytho... | trusted_official_docs | CPython Docs | library. It was :ref:`removed in Python 3.12 <whatsnew312-removed-distutils>` after being deprecated in Python 3.10. The removal was decided in :pep:`632`, which has `migration advice <https://peps.python.org/pep-0632/#migration-advice>`_.
The last version of Python that provided the :mod:`!distutils` module was
`Pytho... | library. It was :ref:`removed in Python 3.12 <whatsnew312-removed-distutils>` after being deprecated in Python 3.10. The removal was decided in :pep:`632`, which has `migration advice <https://peps.python.org/pep-0632/#migration-advice>`_.
The last version of Python that provided the :mod:`!distutils` module was
`Pytho... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b4fbb892-682f-4ef6-9f0e-b860a797a259 | CPython Docs | file://datasets/cpython/Doc/library/distutils.rst | unknown | c553245c-cfcf-41a8-8096-72ea9b11554f | 9,064 | supabase-export-v2 | dc8fc8cab883e3db | .. deprecated-removed:: 3.10 3.12
This module is no longer part of the Python standard library. It was :ref:`removed in Python 3.12 <whatsnew312-removed-distutils>` after
being deprecated in Python 3.10. The removal was decided in :pep:`632`,
which has `migration advice
<https://peps.python.org/pep-0632/#migration-advi... | trusted_official_docs | CPython Docs | .. deprecated-removed:: 3.10 3.12
This module is no longer part of the Python standard library. It was :ref:`removed in Python 3.12 <whatsnew312-removed-distutils>` after
being deprecated in Python 3.10. The removal was decided in :pep:`632`,
which has `migration advice
<https://peps.python.org/pep-0632/#migration-advi... | .. deprecated-removed:: 3.10 3.12
This module is no longer part of the Python standard library. It was :ref:`removed in Python 3.12 <whatsnew312-removed-distutils>` after
being deprecated in Python 3.10. The removal was decided in :pep:`632`,
which has `migration advice
<https://peps.python.org/pep-0632/#migration-advi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0384987d-d660-45b6-a46d-156693f573e7 | CPython Docs | file://datasets/cpython/Doc/library/curses.ascii.rst | unknown | 31b34a04-03a0-435e-b1b5-df55897bb3d8 | 9,070 | supabase-export-v2 | 57eb635ea6814355 | --------------
The :mod:`!curses.ascii` module supplies name constants for ASCII characters and
functions to test membership in various ASCII character classes. The constants
supplied are names for control characters as follows: | trusted_official_docs | CPython Docs | --------------
The :mod:`!curses.ascii` module supplies name constants for ASCII characters and
functions to test membership in various ASCII character classes. The constants
supplied are names for control characters as follows: | --------------
The :mod:`!curses.ascii` module supplies name constants for ASCII characters and
functions to test membership in various ASCII character classes. The constants
supplied are names for control characters as follows: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
03f1f036-8637-4465-afb8-8c7d6ac1a84e | CPython Docs | file://datasets/cpython/Doc/library/curses.ascii.rst | unknown | 31b34a04-03a0-435e-b1b5-df55897bb3d8 | 9,119 | supabase-export-v2 | 00a3a9e6609b7fac | Return the 8-bit character corresponding to the given ASCII character (the character bit value is bitwise-ored with 0x80).
The following function takes either a single-character string or integer value;
it returns a string. | trusted_official_docs | CPython Docs | Return the 8-bit character corresponding to the given ASCII character (the character bit value is bitwise-ored with 0x80).
The following function takes either a single-character string or integer value;
it returns a string. | Return the 8-bit character corresponding to the given ASCII character (the character bit value is bitwise-ored with 0x80).
The following function takes either a single-character string or integer value;
it returns a string. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0ebacb20-7a99-4640-8c72-82e6da554aca | CPython Docs | file://datasets/cpython/Doc/library/curses.ascii.rst | unknown | 31b34a04-03a0-435e-b1b5-df55897bb3d8 | 9,077 | supabase-export-v2 | 53459a0c5833f1ec | Record separator, block-mode terminator | +---------------+----------------------------------------------+ | .. data:: US | Unit separator | +---------------+----------------------------------------------+ | .. data:: SP | Space | +---------------+----------------------------------------------+ | ..
data:: DEL | Delete... | trusted_official_docs | CPython Docs | Record separator, block-mode terminator | +---------------+----------------------------------------------+ | .. data:: US | Unit separator | +---------------+----------------------------------------------+ | .. data:: SP | Space | +---------------+----------------------------------------------+ | ..
data:: DEL | Delete... | Record separator, block-mode terminator | +---------------+----------------------------------------------+ | .. data:: US | Unit separator | +---------------+----------------------------------------------+ | .. data:: SP | Space | +---------------+----------------------------------------------+ | ..
data:: DEL | Delete... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
40b45834-b333-4752-bd3b-7d77da3a51fd | CPython Docs | file://datasets/cpython/Doc/library/curses.ascii.rst | unknown | 31b34a04-03a0-435e-b1b5-df55897bb3d8 | 9,122 | supabase-export-v2 | 4cdff863220e5c28 | .. function:: unctrl(c)
Return a string representation of the ASCII character *c*. If *c* is printable,
this string is the character itself. If the character is a control character
(0x00--0x1f) the string consists of a caret (``'^'``) followed by the
corresponding uppercase letter. If the character is an ASCII delet... | trusted_official_docs | CPython Docs | .. function:: unctrl(c)
Return a string representation of the ASCII character *c*. If *c* is printable,
this string is the character itself. If the character is a control character
(0x00--0x1f) the string consists of a caret (``'^'``) followed by the
corresponding uppercase letter. If the character is an ASCII delet... | .. function:: unctrl(c)
Return a string representation of the ASCII character *c*. If *c* is printable,
this string is the character itself. If the character is a control character
(0x00--0x1f) the string consists of a caret (``'^'``) followed by the
corresponding uppercase letter. If the character is an ASCII delet... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4b6d6f9c-cbde-4793-a914-cad13ffe606c | CPython Docs | file://datasets/cpython/Doc/library/curses.ascii.rst | unknown | 31b34a04-03a0-435e-b1b5-df55897bb3d8 | 9,075 | supabase-export-v2 | 3cea3657a90268bd | | +---------------+----------------------------------------------+ | .. data:: DC3 | XOFF, for flow control | +---------------+----------------------------------------------+ | .. data:: DC4 | Device control 4 | +---------------+----------------------------------------------+ | ..
data:: NAK | Negative acknowledgement ... | trusted_official_docs | CPython Docs | | +---------------+----------------------------------------------+ | .. data:: DC3 | XOFF, for flow control | +---------------+----------------------------------------------+ | .. data:: DC4 | Device control 4 | +---------------+----------------------------------------------+ | ..
data:: NAK | Negative acknowledgement ... | | +---------------+----------------------------------------------+ | .. data:: DC3 | XOFF, for flow control | +---------------+----------------------------------------------+ | .. data:: DC4 | Device control 4 | +---------------+----------------------------------------------+ | ..
data:: NAK | Negative acknowledgement ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
55eaea1c-109b-4bd0-9298-c3e6bdce6938 | CPython Docs | file://datasets/cpython/Doc/library/curses.ascii.rst | unknown | 31b34a04-03a0-435e-b1b5-df55897bb3d8 | 9,111 | supabase-export-v2 | 6b576d6ba83e1dde | These functions accept either integers or single-character strings; when the argument is a string, it is first converted using the built-in function :func:`ord`.
Note that all these functions check ordinal bit values derived from the
character of the string you pass in; they do not actually know anything about
the host... | trusted_official_docs | CPython Docs | These functions accept either integers or single-character strings; when the argument is a string, it is first converted using the built-in function :func:`ord`.
Note that all these functions check ordinal bit values derived from the
character of the string you pass in; they do not actually know anything about
the host... | These functions accept either integers or single-character strings; when the argument is a string, it is first converted using the built-in function :func:`ord`.
Note that all these functions check ordinal bit values derived from the
character of the string you pass in; they do not actually know anything about
the host... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
59222648-d5f4-48a8-9081-25d709f0562c | CPython Docs | file://datasets/cpython/Doc/library/curses.ascii.rst | unknown | 31b34a04-03a0-435e-b1b5-df55897bb3d8 | 9,112 | supabase-export-v2 | d54343ba11b447af | ordinal bit values derived from the character of the string you pass in; they do not actually know anything about the host machine's character encoding.
The following two functions take either a single-character string or integer
byte value; they return a value of the same type. | trusted_official_docs | CPython Docs | ordinal bit values derived from the character of the string you pass in; they do not actually know anything about the host machine's character encoding.
The following two functions take either a single-character string or integer
byte value; they return a value of the same type. | ordinal bit values derived from the character of the string you pass in; they do not actually know anything about the host machine's character encoding.
The following two functions take either a single-character string or integer
byte value; they return a value of the same type. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
623369f1-c4f4-4fd6-b510-97c5cb123c20 | CPython Docs | file://datasets/cpython/Doc/library/curses.ascii.rst | unknown | 31b34a04-03a0-435e-b1b5-df55897bb3d8 | 9,110 | supabase-export-v2 | 3113dfbcb2b24b55 | Checks for a non-ASCII character (ordinal values 0x80 and above).
These functions accept either integers or single-character strings; when the argument is a
string, it is first converted using the built-in function :func:`ord`. | trusted_official_docs | CPython Docs | Checks for a non-ASCII character (ordinal values 0x80 and above).
These functions accept either integers or single-character strings; when the argument is a
string, it is first converted using the built-in function :func:`ord`. | Checks for a non-ASCII character (ordinal values 0x80 and above).
These functions accept either integers or single-character strings; when the argument is a
string, it is first converted using the built-in function :func:`ord`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
64a1de95-925a-410d-b720-7964d45cbeb8 | CPython Docs | file://datasets/cpython/Doc/library/curses.ascii.rst | unknown | 31b34a04-03a0-435e-b1b5-df55897bb3d8 | 9,073 | supabase-export-v2 | 8dda2e568f0385d6 | Backspace | +---------------+----------------------------------------------+ | .. data:: TAB | Tab | +---------------+----------------------------------------------+ | .. data:: HT | Alias for :const:`TAB`: "Horizontal tab" | +---------------+----------------------------------------------+ | ..
data:: LF | Line feed |
... | trusted_official_docs | CPython Docs | Backspace | +---------------+----------------------------------------------+ | .. data:: TAB | Tab | +---------------+----------------------------------------------+ | .. data:: HT | Alias for :const:`TAB`: "Horizontal tab" | +---------------+----------------------------------------------+ | ..
data:: LF | Line feed |
... | Backspace | +---------------+----------------------------------------------+ | .. data:: TAB | Tab | +---------------+----------------------------------------------+ | .. data:: HT | Alias for :const:`TAB`: "Horizontal tab" | +---------------+----------------------------------------------+ | ..
data:: LF | Line feed |
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
74fc8204-8be3-4688-824c-1b9f85d73ba0 | CPython Docs | file://datasets/cpython/Doc/library/curses.ascii.rst | unknown | 31b34a04-03a0-435e-b1b5-df55897bb3d8 | 9,072 | supabase-export-v2 | beb2efb4b3bfdd2b | text | +---------------+----------------------------------------------+ | .. data:: ETX | End of text | +---------------+----------------------------------------------+ | .. data:: EOT | End of transmission | +---------------+----------------------------------------------+ | ..
data:: ENQ | Enquiry, goes with :const:`A... | trusted_official_docs | CPython Docs | text | +---------------+----------------------------------------------+ | .. data:: ETX | End of text | +---------------+----------------------------------------------+ | .. data:: EOT | End of transmission | +---------------+----------------------------------------------+ | ..
data:: ENQ | Enquiry, goes with :const:`A... | text | +---------------+----------------------------------------------+ | .. data:: ETX | End of text | +---------------+----------------------------------------------+ | .. data:: EOT | End of transmission | +---------------+----------------------------------------------+ | ..
data:: ENQ | Enquiry, goes with :const:`A... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
90092567-e5c0-466b-95b4-82b02d93ebd5 | CPython Docs | file://datasets/cpython/Doc/library/curses.ascii.rst | unknown | 31b34a04-03a0-435e-b1b5-df55897bb3d8 | 9,076 | supabase-export-v2 | 5a9839b543a568a9 | CAN | Cancel | +---------------+----------------------------------------------+ | .. data:: EM | End of medium | +---------------+----------------------------------------------+ | .. data:: SUB | Substitute | +---------------+----------------------------------------------+ | ..
data:: ESC | Escape |
+---------------+--... | trusted_official_docs | CPython Docs | CAN | Cancel | +---------------+----------------------------------------------+ | .. data:: EM | End of medium | +---------------+----------------------------------------------+ | .. data:: SUB | Substitute | +---------------+----------------------------------------------+ | ..
data:: ESC | Escape |
+---------------+--... | CAN | Cancel | +---------------+----------------------------------------------+ | .. data:: EM | End of medium | +---------------+----------------------------------------------+ | .. data:: SUB | Substitute | +---------------+----------------------------------------------+ | ..
data:: ESC | Escape |
+---------------+--... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9582e73f-e311-4a11-89b1-800208cb5bbb | CPython Docs | file://datasets/cpython/Doc/library/curses.ascii.rst | unknown | 31b34a04-03a0-435e-b1b5-df55897bb3d8 | 9,071 | supabase-export-v2 | cfe9b2731bbf6891 | name constants for ASCII characters and functions to test membership in various ASCII character classes. The constants supplied are names for control characters as follows:
+---------------+----------------------------------------------+
| Name | Meaning |
+===============+==============================================... | trusted_official_docs | CPython Docs | name constants for ASCII characters and functions to test membership in various ASCII character classes. The constants supplied are names for control characters as follows:
+---------------+----------------------------------------------+
| Name | Meaning |
+===============+==============================================... | name constants for ASCII characters and functions to test membership in various ASCII character classes. The constants supplied are names for control characters as follows:
+---------------+----------------------------------------------+
| Name | Meaning |
+===============+==============================================... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9854a1f4-395d-47cc-b11f-3f0a1db8a4cf | CPython Docs | file://datasets/cpython/Doc/library/curses.ascii.rst | unknown | 31b34a04-03a0-435e-b1b5-df55897bb3d8 | 9,124 | supabase-export-v2 | d175cb6bd152b342 | .. data:: controlnames
A 33-element string array that contains the ASCII mnemonics for the thirty-two
ASCII control characters from 0 (NUL) to 0x1f (US), in order, plus the mnemonic
``SP`` for the space character. | trusted_official_docs | CPython Docs | .. data:: controlnames
A 33-element string array that contains the ASCII mnemonics for the thirty-two
ASCII control characters from 0 (NUL) to 0x1f (US), in order, plus the mnemonic
``SP`` for the space character. | .. data:: controlnames
A 33-element string array that contains the ASCII mnemonics for the thirty-two
ASCII control characters from 0 (NUL) to 0x1f (US), in order, plus the mnemonic
``SP`` for the space character. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
be15fe97-712c-4a08-8011-5cc22de7fc87 | CPython Docs | file://datasets/cpython/Doc/library/curses.ascii.rst | unknown | 31b34a04-03a0-435e-b1b5-df55897bb3d8 | 9,079 | supabase-export-v2 | d8317d46b05f14dd | Note that many of these have little practical significance in modern usage. The mnemonics derive from teleprinter conventions that predate digital computers.
The module supplies the following functions, patterned on those in the standard
C library: | trusted_official_docs | CPython Docs | Note that many of these have little practical significance in modern usage. The mnemonics derive from teleprinter conventions that predate digital computers.
The module supplies the following functions, patterned on those in the standard
C library: | Note that many of these have little practical significance in modern usage. The mnemonics derive from teleprinter conventions that predate digital computers.
The module supplies the following functions, patterned on those in the standard
C library: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fa91f0bc-a8e5-4139-a071-5a450d4667a6 | CPython Docs | file://datasets/cpython/Doc/library/curses.ascii.rst | unknown | 31b34a04-03a0-435e-b1b5-df55897bb3d8 | 9,074 | supabase-export-v2 | eff9e05282ced43e | | +---------------+----------------------------------------------+ | .. data:: CR | Carriage return | +---------------+----------------------------------------------+ | .. data:: SO | Shift-out, begin alternate character set | +---------------+----------------------------------------------+ | ..
data:: SI | Shift-in, r... | trusted_official_docs | CPython Docs | | +---------------+----------------------------------------------+ | .. data:: CR | Carriage return | +---------------+----------------------------------------------+ | .. data:: SO | Shift-out, begin alternate character set | +---------------+----------------------------------------------+ | ..
data:: SI | Shift-in, r... | | +---------------+----------------------------------------------+ | .. data:: CR | Carriage return | +---------------+----------------------------------------------+ | .. data:: SO | Shift-out, begin alternate character set | +---------------+----------------------------------------------+ | ..
data:: SI | Shift-in, r... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0535eb38-c2fa-419c-a1fe-af8efb872e3e | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,222 | supabase-export-v2 | b4c2b330a23bb290 | The Python REPL is another example of a "top-level environment", so anything defined in the REPL becomes part of the ``__main__`` scope::
>>> import namely
>>> namely.did_user_define_their_name()
False
>>> namely.print_user_name()
Traceback (most recent call last):
... ValueError: Define the variable `my_name`! >>... | trusted_official_docs | CPython Docs | The Python REPL is another example of a "top-level environment", so anything defined in the REPL becomes part of the ``__main__`` scope::
>>> import namely
>>> namely.did_user_define_their_name()
False
>>> namely.print_user_name()
Traceback (most recent call last):
... ValueError: Define the variable `my_name`! >>... | The Python REPL is another example of a "top-level environment", so anything defined in the REPL becomes part of the ``__main__`` scope::
>>> import namely
>>> namely.did_user_define_their_name()
False
>>> namely.print_user_name()
Traceback (most recent call last):
... ValueError: Define the variable `my_name`! >>... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0dfead1b-4e66-49bf-94cb-0464279cbc14 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,130 | supabase-export-v2 | 2f820fe8d6eb13f2 | of the top-level environment of the program, which can be checked using the ``__name__ == '__main__'`` expression; and 2. the ``__main__.py`` file in Python packages.
Both of these mechanisms are related to Python modules; how users interact with
them and how they interact with each other. They are explained in detail
... | trusted_official_docs | CPython Docs | of the top-level environment of the program, which can be checked using the ``__name__ == '__main__'`` expression; and 2. the ``__main__.py`` file in Python packages.
Both of these mechanisms are related to Python modules; how users interact with
them and how they interact with each other. They are explained in detail
... | of the top-level environment of the program, which can be checked using the ``__name__ == '__main__'`` expression; and 2. the ``__main__.py`` file in Python packages.
Both of these mechanisms are related to Python modules; how users interact with
them and how they interact with each other. They are explained in detail
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
160638db-20b5-43b6-aa70-f8b6876eb5f1 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,194 | supabase-export-v2 | 4ae71594bcfb7e92 | those files are kept short and import functions to execute from other modules. Those other modules can then be easily unit-tested and are properly reusable.
If used, an ``if __name__ == '__main__'`` block will still work as expected
for a ``__main__.py`` file within a package, because its ``__name__``
attribute will in... | trusted_official_docs | CPython Docs | those files are kept short and import functions to execute from other modules. Those other modules can then be easily unit-tested and are properly reusable.
If used, an ``if __name__ == '__main__'`` block will still work as expected
for a ``__main__.py`` file within a package, because its ``__name__``
attribute will in... | those files are kept short and import functions to execute from other modules. Those other modules can then be easily unit-tested and are properly reusable.
If used, an ``if __name__ == '__main__'`` block will still work as expected
for a ``__main__.py`` file within a package, because its ``__name__``
attribute will in... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1bd3435f-a24a-4c13-8297-43483409aeef | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,159 | supabase-export-v2 | 65ed26bb136a12c2 | environment by checking its own ``__name__``, which allows a common idiom for conditionally executing code when the module is not initialized from an import statement::
if __name__ == '__main__':
# Execute when the module is not initialized from an import statement. ... | trusted_official_docs | CPython Docs | environment by checking its own ``__name__``, which allows a common idiom for conditionally executing code when the module is not initialized from an import statement::
if __name__ == '__main__':
# Execute when the module is not initialized from an import statement. ... | environment by checking its own ``__name__``, which allows a common idiom for conditionally executing code when the module is not initialized from an import statement::
if __name__ == '__main__':
# Execute when the module is not initialized from an import statement. ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2070027c-4e2b-413d-ba34-fbdcb9eabad2 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,133 | supabase-export-v2 | 7c9bc4c73080ccf1 | ``__name__ == '__main__'`` ---------------------------
When a Python module or package is imported, ``__name__`` is set to the
module's name. Usually, this is the name of the Python file itself without the
``.py`` extension:: | trusted_official_docs | CPython Docs | ``__name__ == '__main__'`` ---------------------------
When a Python module or package is imported, ``__name__`` is set to the
module's name. Usually, this is the name of the Python file itself without the
``.py`` extension:: | ``__name__ == '__main__'`` ---------------------------
When a Python module or package is imported, ``__name__`` is set to the
module's name. Usually, this is the name of the Python file itself without the
``.py`` extension:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
341213e3-96cf-4d39-98c3-ce83293b6d08 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,163 | supabase-export-v2 | 3acc2c7c3a2ae320 | Idiomatic Usage ^^^^^^^^^^^^^^^
Some modules contain code that is intended for script use only, like parsing
command-line arguments or fetching data from standard input. If a module
like this was imported from a different module, for example to unit test
it, the script code would unintentionally execute as well. | trusted_official_docs | CPython Docs | Idiomatic Usage ^^^^^^^^^^^^^^^
Some modules contain code that is intended for script use only, like parsing
command-line arguments or fetching data from standard input. If a module
like this was imported from a different module, for example to unit test
it, the script code would unintentionally execute as well. | Idiomatic Usage ^^^^^^^^^^^^^^^
Some modules contain code that is intended for script use only, like parsing
command-line arguments or fetching data from standard input. If a module
like this was imported from a different module, for example to unit test
it, the script code would unintentionally execute as well. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
38feba61-97b3-4bba-a2bf-26df194b8505 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,200 | supabase-export-v2 | 8027c458366d79cd | See :mod:`runpy` for more details on the :option:`-m` flag to the interpreter executable.
See :mod:`zipapp` for how to run applications packaged as *.zip* files. In
this case Python looks for a ``__main__.py`` file in the root directory of
the archive. | trusted_official_docs | CPython Docs | See :mod:`runpy` for more details on the :option:`-m` flag to the interpreter executable.
See :mod:`zipapp` for how to run applications packaged as *.zip* files. In
this case Python looks for a ``__main__.py`` file in the root directory of
the archive. | See :mod:`runpy` for more details on the :option:`-m` flag to the interpreter executable.
See :mod:`zipapp` for how to run applications packaged as *.zip* files. In
this case Python looks for a ``__main__.py`` file in the root directory of
the archive. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
50223fd2-c2a6-41de-bfe8-856cd2383240 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,202 | supabase-export-v2 | 0d0cc6749f6a2e83 | ``import __main__`` -------------------
Regardless of which module a Python program was started with, other modules
running within that same program can import the top-level environment's scope
(:term:`namespace`) by importing the ``__main__`` module. This doesn't import
a ``__main__.py`` file but rather whichever modu... | trusted_official_docs | CPython Docs | ``import __main__`` -------------------
Regardless of which module a Python program was started with, other modules
running within that same program can import the top-level environment's scope
(:term:`namespace`) by importing the ``__main__`` module. This doesn't import
a ``__main__.py`` file but rather whichever modu... | ``import __main__`` -------------------
Regardless of which module a Python program was started with, other modules
running within that same program can import the top-level environment's scope
(:term:`namespace`) by importing the ``__main__`` module. This doesn't import
a ``__main__.py`` file but rather whichever modu... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
581fd8b4-dd1a-44de-bd48-de5ba37e8305 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,176 | supabase-export-v2 | 633a26c8e3e2305b | value acceptable as an input to :func:`sys.exit`; typically, an integer or ``None`` (which is implicitly returned if your function does not have a return statement).
By proactively following this convention ourselves, our module will have the
same behavior when run directly (i.e. ``python echo.py``) as it will have if
... | trusted_official_docs | CPython Docs | value acceptable as an input to :func:`sys.exit`; typically, an integer or ``None`` (which is implicitly returned if your function does not have a return statement).
By proactively following this convention ourselves, our module will have the
same behavior when run directly (i.e. ``python echo.py``) as it will have if
... | value acceptable as an input to :func:`sys.exit`; typically, an integer or ``None`` (which is implicitly returned if your function does not have a return statement).
By proactively following this convention ourselves, our module will have the
same behavior when run directly (i.e. ``python echo.py``) as it will have if
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
594adb3b-2d05-4a31-aa37-fcc473260459 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,173 | supabase-export-v2 | 15a99512e9fb8767 | Packaging Considerations ^^^^^^^^^^^^^^^^^^^^^^^^
``main`` functions are often used to create command-line tools by specifying
them as entry points for console scripts. When this is done,
`pip <https://pip.pypa.io/>`_ inserts the function call into a template script,
where the return value of ``main`` is passed into :f... | trusted_official_docs | CPython Docs | Packaging Considerations ^^^^^^^^^^^^^^^^^^^^^^^^
``main`` functions are often used to create command-line tools by specifying
them as entry points for console scripts. When this is done,
`pip <https://pip.pypa.io/>`_ inserts the function call into a template script,
where the return value of ``main`` is passed into :f... | Packaging Considerations ^^^^^^^^^^^^^^^^^^^^^^^^
``main`` functions are often used to create command-line tools by specifying
them as entry points for console scripts. When this is done,
`pip <https://pip.pypa.io/>`_ inserts the function call into a template script,
where the return value of ``main`` is passed into :f... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5e6d092e-4faf-4a10-bbdf-7e98032ccdf4 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,177 | supabase-export-v2 | d06e2dcb9e938041 | behavior when run directly (i.e. ``python echo.py``) as it will have if we later package it as a console script entry-point in a pip-installable package.
In particular, be careful about returning strings from your ``main`` function. :func:`sys.exit` will interpret a string argument as a failure message, so
your program... | trusted_official_docs | CPython Docs | behavior when run directly (i.e. ``python echo.py``) as it will have if we later package it as a console script entry-point in a pip-installable package.
In particular, be careful about returning strings from your ``main`` function. :func:`sys.exit` will interpret a string argument as a failure message, so
your program... | behavior when run directly (i.e. ``python echo.py``) as it will have if we later package it as a console script entry-point in a pip-installable package.
In particular, be careful about returning strings from your ``main`` function. :func:`sys.exit` will interpret a string argument as a failure message, so
your program... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
60d7921e-0cc9-45e1-9a4f-7a11c9cd46b3 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,165 | supabase-export-v2 | ea40255aa65ab965 | the ``if __name__ == '__main__'`` code block comes in handy. Code within this block won't run unless the module is executed in the top-level environment.
Putting as few statements as possible in the block below ``if __name__ ==
'__main__'`` can improve code clarity and correctness. Most often, a function
named ``main``... | trusted_official_docs | CPython Docs | the ``if __name__ == '__main__'`` code block comes in handy. Code within this block won't run unless the module is executed in the top-level environment.
Putting as few statements as possible in the block below ``if __name__ ==
'__main__'`` can improve code clarity and correctness. Most often, a function
named ``main``... | the ``if __name__ == '__main__'`` code block comes in handy. Code within this block won't run unless the module is executed in the top-level environment.
Putting as few statements as possible in the block below ``if __name__ ==
'__main__'`` can improve code clarity and correctness. Most often, a function
named ``main``... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6620f396-38d7-466b-95c2-bd2c3d1fd4ec | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,203 | supabase-export-v2 | 03c2665731c0306d | top-level environment's scope (:term:`namespace`) by importing the ``__main__`` module. This doesn't import a ``__main__.py`` file but rather whichever module that received the special name ``'__main__'``.
Here is an example module that consumes the ``__main__`` namespace:: | trusted_official_docs | CPython Docs | top-level environment's scope (:term:`namespace`) by importing the ``__main__`` module. This doesn't import a ``__main__.py`` file but rather whichever module that received the special name ``'__main__'``.
Here is an example module that consumes the ``__main__`` namespace:: | top-level environment's scope (:term:`namespace`) by importing the ``__main__`` module. This doesn't import a ``__main__.py`` file but rather whichever module that received the special name ``'__main__'``.
Here is an example module that consumes the ``__main__`` namespace:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
66b6e718-c73a-4f79-985d-a6c7be58329d | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,167 | supabase-export-v2 | a1e28bfdefc3509d | import shlex import sys
def echo(phrase: str) -> None:
"""A dummy wrapper around print."""
# for demonstration purposes, you can imagine that there is some
# valuable and reusable logic inside this function
print(phrase) | trusted_official_docs | CPython Docs | import shlex import sys
def echo(phrase: str) -> None:
"""A dummy wrapper around print."""
# for demonstration purposes, you can imagine that there is some
# valuable and reusable logic inside this function
print(phrase) | import shlex import sys
def echo(phrase: str) -> None:
"""A dummy wrapper around print."""
# for demonstration purposes, you can imagine that there is some
# valuable and reusable logic inside this function
print(phrase) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
66d3aad6-6158-4f12-b93f-0380eeaadd7d | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,129 | supabase-export-v2 | 96f6905e2f64e6c7 | In Python, the special name ``__main__`` is used for two important constructs:
1. the name of the top-level environment of the program, which can be
checked using the ``__name__ == '__main__'`` expression; and
2. the ``__main__.py`` file in Python packages. | trusted_official_docs | CPython Docs | In Python, the special name ``__main__`` is used for two important constructs:
1. the name of the top-level environment of the program, which can be
checked using the ``__name__ == '__main__'`` expression; and
2. the ``__main__.py`` file in Python packages. | In Python, the special name ``__main__`` is used for two important constructs:
1. the name of the top-level environment of the program, which can be
checked using the ``__name__ == '__main__'`` expression; and
2. the ``__main__.py`` file in Python packages. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
735d2d15-f697-4d49-88ff-3bf2a72c0eef | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,181 | supabase-export-v2 | 49da20d6b91bf6e1 | ``__main__.py`` in Python Packages ----------------------------------
If you are not familiar with Python packages, see section :ref:`tut-packages`
of the tutorial. Most commonly, the ``__main__.py`` file is used to provide
a command-line interface for a package. Consider the following hypothetical
package, "bandclass"... | trusted_official_docs | CPython Docs | ``__main__.py`` in Python Packages ----------------------------------
If you are not familiar with Python packages, see section :ref:`tut-packages`
of the tutorial. Most commonly, the ``__main__.py`` file is used to provide
a command-line interface for a package. Consider the following hypothetical
package, "bandclass"... | ``__main__.py`` in Python Packages ----------------------------------
If you are not familiar with Python packages, see section :ref:`tut-packages`
of the tutorial. Most commonly, the ``__main__.py`` file is used to provide
a command-line interface for a package. Consider the following hypothetical
package, "bandclass"... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
73a94270-89a9-4318-a783-b97b1635214b | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,170 | supabase-export-v2 | cd724d8e6a362b34 | if __name__ == '__main__': sys.exit(main()) # next section explains the use of sys.exit
Note that if the module didn't encapsulate code inside the ``main`` function
but instead put it directly within the ``if __name__ == '__main__'`` block,
the ``phrase`` variable would be global to the entire module. This is
error-pro... | trusted_official_docs | CPython Docs | if __name__ == '__main__': sys.exit(main()) # next section explains the use of sys.exit
Note that if the module didn't encapsulate code inside the ``main`` function
but instead put it directly within the ``if __name__ == '__main__'`` block,
the ``phrase`` variable would be global to the entire module. This is
error-pro... | if __name__ == '__main__': sys.exit(main()) # next section explains the use of sys.exit
Note that if the module didn't encapsulate code inside the ``main`` function
but instead put it directly within the ``if __name__ == '__main__'`` block,
the ``phrase`` variable would be global to the entire module. This is
error-pro... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
82a0115d-8bf1-4f8a-8c99-147af9b977b5 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,196 | supabase-export-v2 | eb7146be1d1a6f7c | >>> import asyncio.__main__ >>> asyncio.__main__.__name__ 'asyncio.__main__'
This won't work for ``__main__.py`` files in the root directory of a
``.zip`` file though. Hence, for consistency, a minimal ``__main__.py``
without a ``__name__`` check is preferred. | trusted_official_docs | CPython Docs | >>> import asyncio.__main__ >>> asyncio.__main__.__name__ 'asyncio.__main__'
This won't work for ``__main__.py`` files in the root directory of a
``.zip`` file though. Hence, for consistency, a minimal ``__main__.py``
without a ``__name__`` check is preferred. | >>> import asyncio.__main__ >>> asyncio.__main__.__name__ 'asyncio.__main__'
This won't work for ``__main__.py`` files in the root directory of a
``.zip`` file though. Hence, for consistency, a minimal ``__main__.py``
without a ``__name__`` check is preferred. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
85765e1b-067a-4006-b852-267e139cfa75 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,134 | supabase-export-v2 | dcd1425d0f5d4260 | or package is imported, ``__name__`` is set to the module's name. Usually, this is the name of the Python file itself without the ``.py`` extension::
>>> import configparser
>>> configparser.__name__
'configparser' | trusted_official_docs | CPython Docs | or package is imported, ``__name__`` is set to the module's name. Usually, this is the name of the Python file itself without the ``.py`` extension::
>>> import configparser
>>> configparser.__name__
'configparser' | or package is imported, ``__name__`` is set to the module's name. Usually, this is the name of the Python file itself without the ``.py`` extension::
>>> import configparser
>>> configparser.__name__
'configparser' | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
86fd0ec5-fbf8-4b47-984c-842ce234fa92 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,171 | supabase-export-v2 | dc7d408fc58aa6a8 | error-prone as other functions within the module could be unintentionally using the global variable instead of a local name. A ``main`` function solves this problem.
Using a ``main`` function has the added benefit of the ``echo`` function itself
being isolated and importable elsewhere. When ``echo.py`` is imported, the... | trusted_official_docs | CPython Docs | error-prone as other functions within the module could be unintentionally using the global variable instead of a local name. A ``main`` function solves this problem.
Using a ``main`` function has the added benefit of the ``echo`` function itself
being isolated and importable elsewhere. When ``echo.py`` is imported, the... | error-prone as other functions within the module could be unintentionally using the global variable instead of a local name. A ``main`` function solves this problem.
Using a ``main`` function has the added benefit of the ``echo`` function itself
being isolated and importable elsewhere. When ``echo.py`` is imported, the... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
876fc61d-fe90-4a7b-be0e-6f4ccfff2384 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,169 | supabase-export-v2 | 2ffb8b8634038ad2 | def main() -> int: """Echo the input arguments to standard output""" phrase = shlex.join(sys.argv) echo(phrase) return 0
if __name__ == '__main__':
sys.exit(main()) # next section explains the use of sys.exit | trusted_official_docs | CPython Docs | def main() -> int: """Echo the input arguments to standard output""" phrase = shlex.join(sys.argv) echo(phrase) return 0
if __name__ == '__main__':
sys.exit(main()) # next section explains the use of sys.exit | def main() -> int: """Echo the input arguments to standard output""" phrase = shlex.join(sys.argv) echo(phrase) return 0
if __name__ == '__main__':
sys.exit(main()) # next section explains the use of sys.exit | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8c6c6e9b-12a6-4753-a334-7b2c7be78f52 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,158 | supabase-export-v2 | 5257b303678ab228 | In each of these situations, the top-level module's ``__name__`` is set to ``'__main__'``.
As a result, a module can discover whether or not it is running in the
top-level environment by checking its own ``__name__``, which allows a common
idiom for conditionally executing code when the module is not initialized from
a... | trusted_official_docs | CPython Docs | In each of these situations, the top-level module's ``__name__`` is set to ``'__main__'``.
As a result, a module can discover whether or not it is running in the
top-level environment by checking its own ``__name__``, which allows a common
idiom for conditionally executing code when the module is not initialized from
a... | In each of these situations, the top-level module's ``__name__`` is set to ``'__main__'``.
As a result, a module can discover whether or not it is running in the
top-level environment by checking its own ``__name__``, which allows a common
idiom for conditionally executing code when the module is not initialized from
a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9292f9f7-1df2-4af0-a5fa-4bac43bd00de | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,187 | supabase-export-v2 | 9e36e3c522aa0848 | $ python -m bandclass
This command will cause ``__main__.py`` to run. How you utilize this mechanism
will depend on the nature of the package you are writing, but in this
hypothetical case, it might make sense to allow the teacher to search for
students:: | trusted_official_docs | CPython Docs | $ python -m bandclass
This command will cause ``__main__.py`` to run. How you utilize this mechanism
will depend on the nature of the package you are writing, but in this
hypothetical case, it might make sense to allow the teacher to search for
students:: | $ python -m bandclass
This command will cause ``__main__.py`` to run. How you utilize this mechanism
will depend on the nature of the package you are writing, but in this
hypothetical case, it might make sense to allow the teacher to search for
students:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9614a28a-fd41-4941-9e10-c9cc0aaa8fe7 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,198 | supabase-export-v2 | bf828041afab6330 | .. seealso::
See :mod:`venv` for an example of a package with a minimal ``__main__.py``
in the standard library. It doesn't contain a ``if __name__ == '__main__'``
block. You can invoke it with ``python -m venv [directory]``. | trusted_official_docs | CPython Docs | .. seealso::
See :mod:`venv` for an example of a package with a minimal ``__main__.py``
in the standard library. It doesn't contain a ``if __name__ == '__main__'``
block. You can invoke it with ``python -m venv [directory]``. | .. seealso::
See :mod:`venv` for an example of a package with a minimal ``__main__.py``
in the standard library. It doesn't contain a ``if __name__ == '__main__'``
block. You can invoke it with ``python -m venv [directory]``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9ca97547-ad74-42d2-80f5-e28fa51ed0a7 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,164 | supabase-export-v2 | ff78fdb8774b9c67 | If a module like this was imported from a different module, for example to unit test it, the script code would unintentionally execute as well.
This is where using the ``if __name__ == '__main__'`` code block comes in
handy. Code within this block won't run unless the module is executed in the
top-level environment. | trusted_official_docs | CPython Docs | If a module like this was imported from a different module, for example to unit test it, the script code would unintentionally execute as well.
This is where using the ``if __name__ == '__main__'`` code block comes in
handy. Code within this block won't run unless the module is executed in the
top-level environment. | If a module like this was imported from a different module, for example to unit test it, the script code would unintentionally execute as well.
This is where using the ``if __name__ == '__main__'`` code block comes in
handy. Code within this block won't run unless the module is executed in the
top-level environment. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9e098ee7-42ae-4a5c-a4c4-eb8fe5cd0b57 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,175 | supabase-export-v2 | 3426d2610af5e91d | sys.exit(main())
Since the call to ``main`` is wrapped in :func:`sys.exit`, the expectation is
that your function will return some value acceptable as an input to
:func:`sys.exit`; typically, an integer or ``None`` (which is implicitly
returned if your function does not have a return statement). | trusted_official_docs | CPython Docs | sys.exit(main())
Since the call to ``main`` is wrapped in :func:`sys.exit`, the expectation is
that your function will return some value acceptable as an input to
:func:`sys.exit`; typically, an integer or ``None`` (which is implicitly
returned if your function does not have a return statement). | sys.exit(main())
Since the call to ``main`` is wrapped in :func:`sys.exit`, the expectation is
that your function will return some value acceptable as an input to
:func:`sys.exit`; typically, an integer or ``None`` (which is implicitly
returned if your function does not have a return statement). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a5d555a7-ffb1-4849-8d5b-28265755f81a | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,223 | supabase-export-v2 | 8febe46621930a69 | namely.did_user_define_their_name() False >>> namely.print_user_name() Traceback (most recent call last): ... ValueError: Define the variable `my_name`! >>> my_name = 'Jabberwocky' >>> namely.did_user_define_their_name() True >>> namely.print_user_name() Jabberwocky
The ``__main__`` scope is used in the implementation ... | trusted_official_docs | CPython Docs | namely.did_user_define_their_name() False >>> namely.print_user_name() Traceback (most recent call last): ... ValueError: Define the variable `my_name`! >>> my_name = 'Jabberwocky' >>> namely.did_user_define_their_name() True >>> namely.print_user_name() Jabberwocky
The ``__main__`` scope is used in the implementation ... | namely.did_user_define_their_name() False >>> namely.print_user_name() Traceback (most recent call last): ... ValueError: Define the variable `my_name`! >>> my_name = 'Jabberwocky' >>> namely.did_user_define_their_name() True >>> namely.print_user_name() Jabberwocky
The ``__main__`` scope is used in the implementation ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
acc21b60-ce28-4a13-9531-51e22984ccb3 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,219 | supabase-export-v2 | f0929119536c9114 | $ python start.py Dinsdale
Note that importing ``__main__`` doesn't cause any issues with unintentionally
running top-level code meant for script use which is put in the
``if __name__ == "__main__"`` block of the ``start`` module. Why does this work? | trusted_official_docs | CPython Docs | $ python start.py Dinsdale
Note that importing ``__main__`` doesn't cause any issues with unintentionally
running top-level code meant for script use which is put in the
``if __name__ == "__main__"`` block of the ``start`` module. Why does this work? | $ python start.py Dinsdale
Note that importing ``__main__`` doesn't cause any issues with unintentionally
running top-level code meant for script use which is put in the
``if __name__ == "__main__"`` block of the ``start`` module. Why does this work? | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bc3d91bb-a6df-460b-ba7a-1ce92616301c | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,191 | supabase-export-v2 | 6fb9c89050355ca8 | student_name = sys.argv[1] if len(sys.argv) >= 2 else '' print(f'Found student: {search_students(student_name)}')
Note that ``from .student import search_students`` is an example of a relative
import. This import style can be used when referencing modules within a
package. For more details, see :ref:`intra-package-refe... | trusted_official_docs | CPython Docs | student_name = sys.argv[1] if len(sys.argv) >= 2 else '' print(f'Found student: {search_students(student_name)}')
Note that ``from .student import search_students`` is an example of a relative
import. This import style can be used when referencing modules within a
package. For more details, see :ref:`intra-package-refe... | student_name = sys.argv[1] if len(sys.argv) >= 2 else '' print(f'Found student: {search_students(student_name)}')
Note that ``from .student import search_students`` is an example of a relative
import. This import style can be used when referencing modules within a
package. For more details, see :ref:`intra-package-refe... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bf74b9bc-caf7-4d39-9a12-f3194c16d3e0 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,220 | supabase-export-v2 | bf0f02a3326b51ac | running top-level code meant for script use which is put in the ``if __name__ == "__main__"`` block of the ``start`` module. Why does this work?
Python inserts an empty ``__main__`` module in :data:`sys.modules` at
interpreter startup, and populates it by running top-level code. In our example
this is the ``start`` mod... | trusted_official_docs | CPython Docs | running top-level code meant for script use which is put in the ``if __name__ == "__main__"`` block of the ``start`` module. Why does this work?
Python inserts an empty ``__main__`` module in :data:`sys.modules` at
interpreter startup, and populates it by running top-level code. In our example
this is the ``start`` mod... | running top-level code meant for script use which is put in the ``if __name__ == "__main__"`` block of the ``start`` module. Why does this work?
Python inserts an empty ``__main__`` module in :data:`sys.modules` at
interpreter startup, and populates it by running top-level code. In our example
this is the ``start`` mod... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bf908804-733b-47ba-b781-f53193a32ca6 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,221 | supabase-export-v2 | 948d8a699f67523c | present in :data:`sys.modules`, Python passes that to ``namely``. See :ref:`Special considerations for __main__ <import-dunder-main>` in the import system's reference for details on how this works.
The Python REPL is another example of a "top-level environment", so anything
defined in the REPL becomes part of the ``__m... | trusted_official_docs | CPython Docs | present in :data:`sys.modules`, Python passes that to ``namely``. See :ref:`Special considerations for __main__ <import-dunder-main>` in the import system's reference for details on how this works.
The Python REPL is another example of a "top-level environment", so anything
defined in the REPL becomes part of the ``__m... | present in :data:`sys.modules`, Python passes that to ``namely``. See :ref:`Special considerations for __main__ <import-dunder-main>` in the import system's reference for details on how this works.
The Python REPL is another example of a "top-level environment", so anything
defined in the REPL becomes part of the ``__m... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c55afee1-2530-4915-93e3-347637beb10f | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,140 | supabase-export-v2 | a082a009be6f040d | starts running. It's "top-level" because it imports all other modules that the program needs. Sometimes "top-level code" is called an *entry point* to the application.
The top-level code environment can be: | trusted_official_docs | CPython Docs | starts running. It's "top-level" because it imports all other modules that the program needs. Sometimes "top-level code" is called an *entry point* to the application.
The top-level code environment can be: | starts running. It's "top-level" because it imports all other modules that the program needs. Sometimes "top-level code" is called an *entry point* to the application.
The top-level code environment can be: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c9cd27b1-406c-48bf-a2fc-657a068dd5b6 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,199 | supabase-export-v2 | c6ecbc329f99f89d | a minimal ``__main__.py`` in the standard library. It doesn't contain a ``if __name__ == '__main__'`` block. You can invoke it with ``python -m venv [directory]``.
See :mod:`runpy` for more details on the :option:`-m` flag to the
interpreter executable. | trusted_official_docs | CPython Docs | a minimal ``__main__.py`` in the standard library. It doesn't contain a ``if __name__ == '__main__'`` block. You can invoke it with ``python -m venv [directory]``.
See :mod:`runpy` for more details on the :option:`-m` flag to the
interpreter executable. | a minimal ``__main__.py`` in the standard library. It doesn't contain a ``if __name__ == '__main__'`` block. You can invoke it with ``python -m venv [directory]``.
See :mod:`runpy` for more details on the :option:`-m` flag to the
interpreter executable. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ca272c0d-de58-4c29-8a8b-bf5c9f59e693 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,216 | supabase-export-v2 | 1338f56d01336988 | $ python start.py Define the variable `my_name`!
The exit code of the program would be 1, indicating an error. Uncommenting the
line with ``my_name = "Dinsdale"`` fixes the program and now it exits with
status code 0, indicating success: | trusted_official_docs | CPython Docs | $ python start.py Define the variable `my_name`!
The exit code of the program would be 1, indicating an error. Uncommenting the
line with ``my_name = "Dinsdale"`` fixes the program and now it exits with
status code 0, indicating success: | $ python start.py Define the variable `my_name`!
The exit code of the program would be 1, indicating an error. Uncommenting the
line with ``my_name = "Dinsdale"`` fixes the program and now it exits with
status code 0, indicating success: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ca784585-0698-472b-90bf-c3e8c6270136 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,195 | supabase-export-v2 | 96d45a1ee3fdc181 | '__main__'`` block will still work as expected for a ``__main__.py`` file within a package, because its ``__name__`` attribute will include the package's path if imported::
>>> import asyncio.__main__
>>> asyncio.__main__.__name__
'asyncio.__main__' | trusted_official_docs | CPython Docs | '__main__'`` block will still work as expected for a ``__main__.py`` file within a package, because its ``__name__`` attribute will include the package's path if imported::
>>> import asyncio.__main__
>>> asyncio.__main__.__name__
'asyncio.__main__' | '__main__'`` block will still work as expected for a ``__main__.py`` file within a package, because its ``__name__`` attribute will include the package's path if imported::
>>> import asyncio.__main__
>>> asyncio.__main__.__name__
'asyncio.__main__' | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d4d65dc8-8358-4a39-b16a-84de9bf5eee7 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,193 | supabase-export-v2 | ff24247b2b9cd5fd | Idiomatic Usage ^^^^^^^^^^^^^^^
The content of ``__main__.py`` typically isn't fenced with an
``if __name__ == '__main__'`` block. Instead, those files are kept
short and import functions to execute from other modules. Those other modules can then be
easily unit-tested and are properly reusable. | trusted_official_docs | CPython Docs | Idiomatic Usage ^^^^^^^^^^^^^^^
The content of ``__main__.py`` typically isn't fenced with an
``if __name__ == '__main__'`` block. Instead, those files are kept
short and import functions to execute from other modules. Those other modules can then be
easily unit-tested and are properly reusable. | Idiomatic Usage ^^^^^^^^^^^^^^^
The content of ``__main__.py`` typically isn't fenced with an
``if __name__ == '__main__'`` block. Instead, those files are kept
short and import functions to execute from other modules. Those other modules can then be
easily unit-tested and are properly reusable. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e5512804-1c32-4e05-9418-47b8a973d27a | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,139 | supabase-export-v2 | 3d8b2dee9f3a3f06 | What is the "top-level code environment"? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
``__main__`` is the name of the environment where top-level code is run. "Top-level code" is the first user-specified Python module that starts running. It's "top-level" because it imports all other modules that the program needs. Somet... | trusted_official_docs | CPython Docs | What is the "top-level code environment"? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
``__main__`` is the name of the environment where top-level code is run. "Top-level code" is the first user-specified Python module that starts running. It's "top-level" because it imports all other modules that the program needs. Somet... | What is the "top-level code environment"? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
``__main__`` is the name of the environment where top-level code is run. "Top-level code" is the first user-specified Python module that starts running. It's "top-level" because it imports all other modules that the program needs. Somet... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eafaebd6-c4b2-47bb-bced-b675bd7bc0a5 | CPython Docs | file://datasets/cpython/Doc/library/__main__.rst | unknown | c997ad14-a054-45af-b17f-3b09af21822e | 9,168 | supabase-export-v2 | 4f81e0831336c99b | """A dummy wrapper around print.""" # for demonstration purposes, you can imagine that there is some # valuable and reusable logic inside this function print(phrase)
def main() -> int:
"""Echo the input arguments to standard output"""
phrase = shlex.join(sys.argv)
echo(phrase)
return 0 | trusted_official_docs | CPython Docs | """A dummy wrapper around print.""" # for demonstration purposes, you can imagine that there is some # valuable and reusable logic inside this function print(phrase)
def main() -> int:
"""Echo the input arguments to standard output"""
phrase = shlex.join(sys.argv)
echo(phrase)
return 0 | """A dummy wrapper around print.""" # for demonstration purposes, you can imagine that there is some # valuable and reusable logic inside this function print(phrase)
def main() -> int:
"""Echo the input arguments to standard output"""
phrase = shlex.join(sys.argv)
echo(phrase)
return 0 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7a531a63-3abd-401d-85fe-54d965678c95 | CPython Docs | file://datasets/cpython/Doc/library/tk.rst | unknown | 62214dc7-0ae6-4eb0-a5ab-4ed340e90a90 | 9,226 | supabase-export-v2 | dd8366bfad0aebe7 | .. index:: single: GUI single: Graphical User Interface single: Tkinter single: Tk
Tk/Tcl has long been an integral part of Python. It provides a robust and
platform independent windowing toolkit, that is available to Python programmers
using the :mod:`tkinter` package, and its extension, the :mod:`tkinter.ttk` module. | trusted_official_docs | CPython Docs | .. index:: single: GUI single: Graphical User Interface single: Tkinter single: Tk
Tk/Tcl has long been an integral part of Python. It provides a robust and
platform independent windowing toolkit, that is available to Python programmers
using the :mod:`tkinter` package, and its extension, the :mod:`tkinter.ttk` module. | .. index:: single: GUI single: Graphical User Interface single: Tkinter single: Tk
Tk/Tcl has long been an integral part of Python. It provides a robust and
platform independent windowing toolkit, that is available to Python programmers
using the :mod:`tkinter` package, and its extension, the :mod:`tkinter.ttk` module. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d7ee3dd7-8219-4022-9ec4-2a5b30e78eb9 | CPython Docs | file://datasets/cpython/Doc/library/tk.rst | unknown | 62214dc7-0ae6-4eb0-a5ab-4ed340e90a90 | 9,227 | supabase-export-v2 | ee7364e41c8e0796 | It provides a robust and platform independent windowing toolkit, that is available to Python programmers using the :mod:`tkinter` package, and its extension, the :mod:`tkinter.ttk` module.
The :mod:`tkinter` package is a thin object-oriented layer on top of Tcl/Tk. To
use :mod:`tkinter`, you don't need to write Tcl cod... | trusted_official_docs | CPython Docs | It provides a robust and platform independent windowing toolkit, that is available to Python programmers using the :mod:`tkinter` package, and its extension, the :mod:`tkinter.ttk` module.
The :mod:`tkinter` package is a thin object-oriented layer on top of Tcl/Tk. To
use :mod:`tkinter`, you don't need to write Tcl cod... | It provides a robust and platform independent windowing toolkit, that is available to Python programmers using the :mod:`tkinter` package, and its extension, the :mod:`tkinter.ttk` module.
The :mod:`tkinter` package is a thin object-oriented layer on top of Tcl/Tk. To
use :mod:`tkinter`, you don't need to write Tcl cod... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e827a190-8a1c-4a49-9239-6934a2a732ae | CPython Docs | file://datasets/cpython/Doc/library/tk.rst | unknown | 62214dc7-0ae6-4eb0-a5ab-4ed340e90a90 | 9,228 | supabase-export-v2 | 5684208cb9873905 | need to consult the Tk documentation, and occasionally the Tcl documentation. :mod:`tkinter` is a set of wrappers that implement the Tk widgets as Python classes.
:mod:`tkinter`'s chief virtues are that it is fast, and that it usually comes
bundled with Python. Although its standard documentation is weak, good
material... | trusted_official_docs | CPython Docs | need to consult the Tk documentation, and occasionally the Tcl documentation. :mod:`tkinter` is a set of wrappers that implement the Tk widgets as Python classes.
:mod:`tkinter`'s chief virtues are that it is fast, and that it usually comes
bundled with Python. Although its standard documentation is weak, good
material... | need to consult the Tk documentation, and occasionally the Tcl documentation. :mod:`tkinter` is a set of wrappers that implement the Tk widgets as Python classes.
:mod:`tkinter`'s chief virtues are that it is fast, and that it usually comes
bundled with Python. Although its standard documentation is weak, good
material... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
00a3cff0-36de-41af-a0ed-68bfed491df4 | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,244 | supabase-export-v2 | df3a48fab6fccd6b | .. versionadded:: 3.15
(4)
Complex types (``F`` and ``D``) are available unconditionally,
regardless on support for complex types (the Annex G of the C11 standard)
by the C compiler. As specified in the C11 standard, each complex type is represented by a
two-element C array containing, respectively, the real and im... | trusted_official_docs | CPython Docs | .. versionadded:: 3.15
(4)
Complex types (``F`` and ``D``) are available unconditionally,
regardless on support for complex types (the Annex G of the C11 standard)
by the C compiler. As specified in the C11 standard, each complex type is represented by a
two-element C array containing, respectively, the real and im... | .. versionadded:: 3.15
(4)
Complex types (``F`` and ``D``) are available unconditionally,
regardless on support for complex types (the Annex G of the C11 standard)
by the C compiler. As specified in the C11 standard, each complex type is represented by a
two-element C array containing, respectively, the real and im... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
021c1b80-d524-4cd0-9b59-5521dafe3951 | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,277 | supabase-export-v2 | a64b93561c73fc46 | .. method:: fromfile(f, n, /)
Read *n* items (as machine values) from the :term:`file object` *f* and append
them to the end of the array. If less than *n* items are available,
:exc:`EOFError` is raised, but the items that were available are still
inserted into the array. | trusted_official_docs | CPython Docs | .. method:: fromfile(f, n, /)
Read *n* items (as machine values) from the :term:`file object` *f* and append
them to the end of the array. If less than *n* items are available,
:exc:`EOFError` is raised, but the items that were available are still
inserted into the array. | .. method:: fromfile(f, n, /)
Read *n* items (as machine values) from the :term:`file object` *f* and append
them to the end of the array. If less than *n* items are available,
:exc:`EOFError` is raised, but the items that were available are still
inserted into the array. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0aef1349-15b4-4fee-bde9-998c7ac710b0 | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,305 | supabase-export-v2 | d22a3674730a06e2 | :class:`~array.array` class has been imported using ``from array import array``. Variables ``inf`` and ``nan`` must also be defined if it contains corresponding floating-point values. Examples::
array('l')
array('w', 'hello \u2641')
array('l', [1, 2, 3, 4, 5])
array('d', [1.0, 2.0, 3.14, -inf, nan]) | trusted_official_docs | CPython Docs | :class:`~array.array` class has been imported using ``from array import array``. Variables ``inf`` and ``nan`` must also be defined if it contains corresponding floating-point values. Examples::
array('l')
array('w', 'hello \u2641')
array('l', [1, 2, 3, 4, 5])
array('d', [1.0, 2.0, 3.14, -inf, nan]) | :class:`~array.array` class has been imported using ``from array import array``. Variables ``inf`` and ``nan`` must also be defined if it contains corresponding floating-point values. Examples::
array('l')
array('w', 'hello \u2641')
array('l', [1, 2, 3, 4, 5])
array('d', [1.0, 2.0, 3.14, -inf, nan]) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0c8e2391-cdf7-40e0-b4b9-eca7cce79f82 | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,255 | supabase-export-v2 | a4c1a7a2aebe0617 | the initializer is passed to the :meth:`fromunicode` method; otherwise, the initializer's iterator is passed to the :meth:`extend` method to add initial items to the array.
Array objects support the ordinary :ref:`mutable <typesseq-mutable>` :term:`sequence` operations of indexing, slicing,
concatenation, and multipli... | trusted_official_docs | CPython Docs | the initializer is passed to the :meth:`fromunicode` method; otherwise, the initializer's iterator is passed to the :meth:`extend` method to add initial items to the array.
Array objects support the ordinary :ref:`mutable <typesseq-mutable>` :term:`sequence` operations of indexing, slicing,
concatenation, and multipli... | the initializer is passed to the :meth:`fromunicode` method; otherwise, the initializer's iterator is passed to the :meth:`extend` method to add initial items to the array.
Array objects support the ordinary :ref:`mutable <typesseq-mutable>` :term:`sequence` operations of indexing, slicing,
concatenation, and multipli... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0e04448a-61e6-4ef0-ac1e-f4d7573c52cc | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,296 | supabase-export-v2 | faf4268e6966c0e8 | .. method:: tobytes()
Convert the array to an array of machine values and return the bytes
representation (the same sequence of bytes that would be written to a file by
the :meth:`tofile` method.) | trusted_official_docs | CPython Docs | .. method:: tobytes()
Convert the array to an array of machine values and return the bytes
representation (the same sequence of bytes that would be written to a file by
the :meth:`tofile` method.) | .. method:: tobytes()
Convert the array to an array of machine values and return the bytes
representation (the same sequence of bytes that would be written to a file by
the :meth:`tofile` method.) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
158b3e9f-7105-475c-ab67-f718e68d7746 | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,256 | supabase-export-v2 | 51525d53a06bfd7d | in all other cases, :exc:`TypeError` is raised. Array objects also implement the buffer interface, and may be used wherever :term:`bytes-like objects <bytes-like object>` are supported.
.. audit-event:: array.__new__ typecode,initializer array.array | trusted_official_docs | CPython Docs | in all other cases, :exc:`TypeError` is raised. Array objects also implement the buffer interface, and may be used wherever :term:`bytes-like objects <bytes-like object>` are supported.
.. audit-event:: array.__new__ typecode,initializer array.array | in all other cases, :exc:`TypeError` is raised. Array objects also implement the buffer interface, and may be used wherever :term:`bytes-like objects <bytes-like object>` are supported.
.. audit-event:: array.__new__ typecode,initializer array.array | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1978b4ce-135c-44ba-82e6-92132056bcc2 | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,303 | supabase-export-v2 | f50fb8c55b6cc50d | .. method:: tounicode()
Convert the array to a Unicode string. The array must have a type ``'u'`` or ``'w'``;
otherwise a :exc:`ValueError` is raised. Use ``array.tobytes().decode(enc)`` to
obtain a Unicode string from an array of some other type. | trusted_official_docs | CPython Docs | .. method:: tounicode()
Convert the array to a Unicode string. The array must have a type ``'u'`` or ``'w'``;
otherwise a :exc:`ValueError` is raised. Use ``array.tobytes().decode(enc)`` to
obtain a Unicode string from an array of some other type. | .. method:: tounicode()
Convert the array to a Unicode string. The array must have a type ``'u'`` or ``'w'``;
otherwise a :exc:`ValueError` is raised. Use ``array.tobytes().decode(enc)`` to
obtain a Unicode string from an array of some other type. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1e2301e9-5973-4145-8094-4cd4a69be76a | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,240 | supabase-export-v2 | a6abfbaa3d144558 | now uses :c:type:`wchar_t` as C type instead of deprecated ``Py_UNICODE``. This change doesn't affect its behavior because ``Py_UNICODE`` is alias of :c:type:`wchar_t` since Python 3.3.
.. deprecated-removed:: 3.3 3.16
Please migrate to ``'w'`` typecode. | trusted_official_docs | CPython Docs | now uses :c:type:`wchar_t` as C type instead of deprecated ``Py_UNICODE``. This change doesn't affect its behavior because ``Py_UNICODE`` is alias of :c:type:`wchar_t` since Python 3.3.
.. deprecated-removed:: 3.3 3.16
Please migrate to ``'w'`` typecode. | now uses :c:type:`wchar_t` as C type instead of deprecated ``Py_UNICODE``. This change doesn't affect its behavior because ``Py_UNICODE`` is alias of :c:type:`wchar_t` since Python 3.3.
.. deprecated-removed:: 3.3 3.16
Please migrate to ``'w'`` typecode. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
23395859-0a3e-4f87-bda1-0eac8f9400bb | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,266 | supabase-export-v2 | 4987963846990461 | .. note::
When using array objects from code written in C or C++ (the only way to
effectively make use of this information), it makes more sense to use the buffer
interface supported by array objects. This method is maintained for backward
compatibility and should be avoided in new code. The buffer interface is
doc... | trusted_official_docs | CPython Docs | .. note::
When using array objects from code written in C or C++ (the only way to
effectively make use of this information), it makes more sense to use the buffer
interface supported by array objects. This method is maintained for backward
compatibility and should be avoided in new code. The buffer interface is
doc... | .. note::
When using array objects from code written in C or C++ (the only way to
effectively make use of this information), it makes more sense to use the buffer
interface supported by array objects. This method is maintained for backward
compatibility and should be avoided in new code. The buffer interface is
doc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
27195126-c42a-438d-a7a5-54d9235c1e1c | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,247 | supabase-export-v2 | 739651b1afe53722 | The :ref:`ctypes <ctypes-fundamental-data-types>` and :ref:`struct <format-characters>` modules, as well as third-party modules like `numpy <https://numpy.org/doc/stable/reference/arrays.interface.html#object.__array_interface__>`__, use similar -- but slightly different -- type codes.
The actual representation of valu... | trusted_official_docs | CPython Docs | The :ref:`ctypes <ctypes-fundamental-data-types>` and :ref:`struct <format-characters>` modules, as well as third-party modules like `numpy <https://numpy.org/doc/stable/reference/arrays.interface.html#object.__array_interface__>`__, use similar -- but slightly different -- type codes.
The actual representation of valu... | The :ref:`ctypes <ctypes-fundamental-data-types>` and :ref:`struct <format-characters>` modules, as well as third-party modules like `numpy <https://numpy.org/doc/stable/reference/arrays.interface.html#object.__array_interface__>`__, use similar -- but slightly different -- type codes.
The actual representation of valu... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
29fb1e97-96f0-458e-8331-bffbf79c064f | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,283 | supabase-export-v2 | bf6021702667082a | .. method:: index(value[, start[, stop]])
Return the smallest *i* such that *i* is the index of the first occurrence of
*value* in the array. The optional arguments *start* and *stop* can be
specified to search for *value* within a subsection of the array. Raise
:exc:`ValueError` if *value* is not found. | trusted_official_docs | CPython Docs | .. method:: index(value[, start[, stop]])
Return the smallest *i* such that *i* is the index of the first occurrence of
*value* in the array. The optional arguments *start* and *stop* can be
specified to search for *value* within a subsection of the array. Raise
:exc:`ValueError` if *value* is not found. | .. method:: index(value[, start[, stop]])
Return the smallest *i* such that *i* is the index of the first occurrence of
*value* in the array. The optional arguments *start* and *stop* can be
specified to search for *value* within a subsection of the array. Raise
:exc:`ValueError` if *value* is not found. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
35ca2db3-f9c7-4c79-9460-b4b669052c2d | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,264 | supabase-export-v2 | be3630e118bd84e0 | .. method:: buffer_info()
Return a tuple ``(address, length)`` giving the current memory address and the
length in elements of the buffer used to hold array's contents. The size of the
memory buffer in bytes can be computed as ``array.buffer_info()[1] *
array.itemsize``. This is occasionally useful when working with... | trusted_official_docs | CPython Docs | .. method:: buffer_info()
Return a tuple ``(address, length)`` giving the current memory address and the
length in elements of the buffer used to hold array's contents. The size of the
memory buffer in bytes can be computed as ``array.buffer_info()[1] *
array.itemsize``. This is occasionally useful when working with... | .. method:: buffer_info()
Return a tuple ``(address, length)`` giving the current memory address and the
length in elements of the buffer used to hold array's contents. The size of the
memory buffer in bytes can be computed as ``array.buffer_info()[1] *
array.itemsize``. This is occasionally useful when working with... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3d0275a5-7367-4c73-9580-591f0c129ed9 | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,268 | supabase-export-v2 | f3e0cd0a35f672ec | .. method:: byteswap()
"Byteswap" all items of the array. This is only supported for values which are
1, 2, 4, 8 or 16 bytes in size; for other types of values, :exc:`RuntimeError` is
raised. It is useful when reading data from a file written on a machine with a
different byte order. Note, that for complex types the... | trusted_official_docs | CPython Docs | .. method:: byteswap()
"Byteswap" all items of the array. This is only supported for values which are
1, 2, 4, 8 or 16 bytes in size; for other types of values, :exc:`RuntimeError` is
raised. It is useful when reading data from a file written on a machine with a
different byte order. Note, that for complex types the... | .. method:: byteswap()
"Byteswap" all items of the array. This is only supported for values which are
1, 2, 4, 8 or 16 bytes in size; for other types of values, :exc:`RuntimeError` is
raised. It is useful when reading data from a file written on a machine with a
different byte order. Note, that for complex types the... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3ecf9302-d086-43eb-abdc-7b7f31f52e13 | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,248 | supabase-export-v2 | 23dcc0e1ad4e271d | representation of values is determined by the machine architecture (strictly speaking, by the C implementation). The actual size can be accessed through the :attr:`array.itemsize` attribute.
The module defines the following item: | trusted_official_docs | CPython Docs | representation of values is determined by the machine architecture (strictly speaking, by the C implementation). The actual size can be accessed through the :attr:`array.itemsize` attribute.
The module defines the following item: | representation of values is determined by the machine architecture (strictly speaking, by the C implementation). The actual size can be accessed through the :attr:`array.itemsize` attribute.
The module defines the following item: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
580b6bb3-8aa3-44fe-9681-71b43a0cf28c | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,235 | supabase-export-v2 | f0eff37a1063c606 | --------------
This module defines an object type which can compactly represent an array of
basic values: characters, integers, floating-point numbers, complex numbers. Arrays are mutable :term:`sequence`
types and behave very much like lists, except that the type of objects stored in
them is constrained. The type is s... | trusted_official_docs | CPython Docs | --------------
This module defines an object type which can compactly represent an array of
basic values: characters, integers, floating-point numbers, complex numbers. Arrays are mutable :term:`sequence`
types and behave very much like lists, except that the type of objects stored in
them is constrained. The type is s... | --------------
This module defines an object type which can compactly represent an array of
basic values: characters, integers, floating-point numbers, complex numbers. Arrays are mutable :term:`sequence`
types and behave very much like lists, except that the type of objects stored in
them is constrained. The type is s... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5d7a7536-7b78-40f4-875d-7af59b336975 | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,274 | supabase-export-v2 | 1401e82fc015035b | .. method:: frombytes(buffer, /)
Appends items from the :term:`bytes-like object`, interpreting
its content as an array of machine values (as if it had been read
from a file using the :meth:`fromfile` method). | trusted_official_docs | CPython Docs | .. method:: frombytes(buffer, /)
Appends items from the :term:`bytes-like object`, interpreting
its content as an array of machine values (as if it had been read
from a file using the :meth:`fromfile` method). | .. method:: frombytes(buffer, /)
Appends items from the :term:`bytes-like object`, interpreting
its content as an array of machine values (as if it had been read
from a file using the :meth:`fromfile` method). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
64d1cbce-067a-4068-9530-d6661249224f | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,281 | supabase-export-v2 | 0b380752962c70b5 | .. method:: fromunicode(ustr, /)
Extends this array with data from the given Unicode string. The array must have type code ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.frombytes(unicodestring.encode(enc))`` to append Unicode data to an
array of some other type. | trusted_official_docs | CPython Docs | .. method:: fromunicode(ustr, /)
Extends this array with data from the given Unicode string. The array must have type code ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.frombytes(unicodestring.encode(enc))`` to append Unicode data to an
array of some other type. | .. method:: fromunicode(ustr, /)
Extends this array with data from the given Unicode string. The array must have type code ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.frombytes(unicodestring.encode(enc))`` to append Unicode data to an
array of some other type. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
663a0b5c-4c68-4c5e-8805-5b171df022b5 | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,304 | supabase-export-v2 | 9414bdf444595569 | have a type ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.tobytes().decode(enc)`` to obtain a Unicode string from an array of some other type.
The string representation of array objects has the form
``array(typecode, initializer)``. The *initializer* is omitted if the array is empty, otherwis... | trusted_official_docs | CPython Docs | have a type ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.tobytes().decode(enc)`` to obtain a Unicode string from an array of some other type.
The string representation of array objects has the form
``array(typecode, initializer)``. The *initializer* is omitted if the array is empty, otherwis... | have a type ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.tobytes().decode(enc)`` to obtain a Unicode string from an array of some other type.
The string representation of array objects has the form
``array(typecode, initializer)``. The *initializer* is omitted if the array is empty, otherwis... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
70cd8eb1-5d9d-46ab-95f0-a245896c435f | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,282 | supabase-export-v2 | 934d99c012b0f83d | must have type code ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.frombytes(unicodestring.encode(enc))`` to append Unicode data to an array of some other type.
.. method:: index(value[, start[, stop]]) | trusted_official_docs | CPython Docs | must have type code ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.frombytes(unicodestring.encode(enc))`` to append Unicode data to an array of some other type.
.. method:: index(value[, start[, stop]]) | must have type code ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.frombytes(unicodestring.encode(enc))`` to append Unicode data to an array of some other type.
.. method:: index(value[, start[, stop]]) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7221240a-77f6-444d-94d2-b4439fb2ff6b | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,297 | supabase-export-v2 | f70845933b92c46a | array of machine values and return the bytes representation (the same sequence of bytes that would be written to a file by the :meth:`tofile` method.)
.. versionadded:: 3.2
:meth:`!tostring` is renamed to :meth:`tobytes` for clarity. | trusted_official_docs | CPython Docs | array of machine values and return the bytes representation (the same sequence of bytes that would be written to a file by the :meth:`tofile` method.)
.. versionadded:: 3.2
:meth:`!tostring` is renamed to :meth:`tobytes` for clarity. | array of machine values and return the bytes representation (the same sequence of bytes that would be written to a file by the :meth:`tofile` method.)
.. versionadded:: 3.2
:meth:`!tostring` is renamed to :meth:`tobytes` for clarity. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
76d0246e-c216-40f9-8450-40a0f18b1797 | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,272 | supabase-export-v2 | 9b7b46887d1d77de | .. method:: extend(iterable, /)
Append items from *iterable* to the end of the array. If *iterable* is another
array, it must have *exactly* the same type code; if not, :exc:`TypeError` will
be raised. If *iterable* is not an array, it must be iterable and its elements
must be the right type to be appended to the ar... | trusted_official_docs | CPython Docs | .. method:: extend(iterable, /)
Append items from *iterable* to the end of the array. If *iterable* is another
array, it must have *exactly* the same type code; if not, :exc:`TypeError` will
be raised. If *iterable* is not an array, it must be iterable and its elements
must be the right type to be appended to the ar... | .. method:: extend(iterable, /)
Append items from *iterable* to the end of the array. If *iterable* is another
array, it must have *exactly* the same type code; if not, :exc:`TypeError` will
be raised. If *iterable* is not an array, it must be iterable and its elements
must be the right type to be appended to the ar... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8885b122-db83-4ea2-a07b-c00c8bcaf062 | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,253 | supabase-export-v2 | fb1390195a9a279a | .. class:: array(typecode[, initializer])
A new array whose items are restricted by *typecode*, and initialized
from the optional *initializer* value, which must be a :class:`bytes`
or :class:`bytearray` object, a Unicode string, or iterable over elements
of the appropriate type. | trusted_official_docs | CPython Docs | .. class:: array(typecode[, initializer])
A new array whose items are restricted by *typecode*, and initialized
from the optional *initializer* value, which must be a :class:`bytes`
or :class:`bytearray` object, a Unicode string, or iterable over elements
of the appropriate type. | .. class:: array(typecode[, initializer])
A new array whose items are restricted by *typecode*, and initialized
from the optional *initializer* value, which must be a :class:`bytes`
or :class:`bytearray` object, a Unicode string, or iterable over elements
of the appropriate type. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9015fba7-527d-49a0-bd1d-8779228dec31 | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,239 | supabase-export-v2 | 89ee59f77f915eb5 | (1) It can be 16 bits or 32 bits depending on the platform.
.. versionchanged:: 3.9
``array('u')`` now uses :c:type:`wchar_t` as C type instead of deprecated
``Py_UNICODE``. This change doesn't affect its behavior because
``Py_UNICODE`` is alias of :c:type:`wchar_t` since Python 3.3. | trusted_official_docs | CPython Docs | (1) It can be 16 bits or 32 bits depending on the platform.
.. versionchanged:: 3.9
``array('u')`` now uses :c:type:`wchar_t` as C type instead of deprecated
``Py_UNICODE``. This change doesn't affect its behavior because
``Py_UNICODE`` is alias of :c:type:`wchar_t` since Python 3.3. | (1) It can be 16 bits or 32 bits depending on the platform.
.. versionchanged:: 3.9
``array('u')`` now uses :c:type:`wchar_t` as C type instead of deprecated
``Py_UNICODE``. This change doesn't affect its behavior because
``Py_UNICODE`` is alias of :c:type:`wchar_t` since Python 3.3. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
98f9a1f6-4d09-4c59-8542-5c952b4a4597 | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,275 | supabase-export-v2 | d9ef43dbd39c71bd | the :term:`bytes-like object`, interpreting its content as an array of machine values (as if it had been read from a file using the :meth:`fromfile` method).
.. versionadded:: 3.2
:meth:`!fromstring` is renamed to :meth:`frombytes` for clarity. | trusted_official_docs | CPython Docs | the :term:`bytes-like object`, interpreting its content as an array of machine values (as if it had been read from a file using the :meth:`fromfile` method).
.. versionadded:: 3.2
:meth:`!fromstring` is renamed to :meth:`frombytes` for clarity. | the :term:`bytes-like object`, interpreting its content as an array of machine values (as if it had been read from a file using the :meth:`fromfile` method).
.. versionadded:: 3.2
:meth:`!fromstring` is renamed to :meth:`frombytes` for clarity. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9f80996a-1bb5-49b5-a0fc-8f5f38faeddc | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,242 | supabase-export-v2 | cb1ceaa98cbafc49 | (2) .. versionadded:: 3.13
(3)
The IEEE 754 binary16 "half precision" type was introduced in the 2008
revision of the `IEEE 754 standard <ieee 754 standard_>`_. This type is not widely supported by C compilers. It's available
as :c:expr:`_Float16` type, if the compiler supports the Annex H
of the C23 standard. | trusted_official_docs | CPython Docs | (2) .. versionadded:: 3.13
(3)
The IEEE 754 binary16 "half precision" type was introduced in the 2008
revision of the `IEEE 754 standard <ieee 754 standard_>`_. This type is not widely supported by C compilers. It's available
as :c:expr:`_Float16` type, if the compiler supports the Annex H
of the C23 standard. | (2) .. versionadded:: 3.13
(3)
The IEEE 754 binary16 "half precision" type was introduced in the 2008
revision of the `IEEE 754 standard <ieee 754 standard_>`_. This type is not widely supported by C compilers. It's available
as :c:expr:`_Float16` type, if the compiler supports the Annex H
of the C23 standard. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ac322d69-3f12-4864-8dca-1f8186976b9e | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,236 | supabase-export-v2 | a48867660e05c0e0 | constrained. The type is specified at object creation time by using a :dfn:`type code`, which is a single character. The following type codes are defined:
+-----------+--------------------+-------------------+-----------------------+-------+
| Type code | C Type | Python Type | Minimum size in bytes | Notes |
+========... | trusted_official_docs | CPython Docs | constrained. The type is specified at object creation time by using a :dfn:`type code`, which is a single character. The following type codes are defined:
+-----------+--------------------+-------------------+-----------------------+-------+
| Type code | C Type | Python Type | Minimum size in bytes | Notes |
+========... | constrained. The type is specified at object creation time by using a :dfn:`type code`, which is a single character. The following type codes are defined:
+-----------+--------------------+-------------------+-----------------------+-------+
| Type code | C Type | Python Type | Minimum size in bytes | Notes |
+========... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b0322d0a-09ca-4a82-aa33-7e6181d28cd8 | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,279 | supabase-export-v2 | 24f2f18f7a7b067d | .. method:: fromlist(list, /)
Append items from the list. This is equivalent to ``for x in list:
a.append(x)`` except that if there is a type error, the array is unchanged. | trusted_official_docs | CPython Docs | .. method:: fromlist(list, /)
Append items from the list. This is equivalent to ``for x in list:
a.append(x)`` except that if there is a type error, the array is unchanged. | .. method:: fromlist(list, /)
Append items from the list. This is equivalent to ``for x in list:
a.append(x)`` except that if there is a type error, the array is unchanged. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bec34129-74fc-494b-ac6c-b97fed3372e5 | CPython Docs | file://datasets/cpython/Doc/library/array.rst | unknown | 4e7f795e-baae-4b76-851e-937a5b5e34ca | 9,254 | supabase-export-v2 | f8d2265faaa31486 | initialized from the optional *initializer* value, which must be a :class:`bytes` or :class:`bytearray` object, a Unicode string, or iterable over elements of the appropriate type.
If given a :class:`bytes` or :class:`bytearray` object, the initializer
is passed to the new array's :meth:`frombytes` method;
if given a... | trusted_official_docs | CPython Docs | initialized from the optional *initializer* value, which must be a :class:`bytes` or :class:`bytearray` object, a Unicode string, or iterable over elements of the appropriate type.
If given a :class:`bytes` or :class:`bytearray` object, the initializer
is passed to the new array's :meth:`frombytes` method;
if given a... | initialized from the optional *initializer* value, which must be a :class:`bytes` or :class:`bytearray` object, a Unicode string, or iterable over elements of the appropriate type.
If given a :class:`bytes` or :class:`bytearray` object, the initializer
is passed to the new array's :meth:`frombytes` method;
if given a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.