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
d3332f4b-d8cd-4c01-ae4e-6190da655473
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,857
supabase-export-v2
74a832e6b996ec0a
>>> r'C:\this\will\not\work\' File "<stdin>", line 1 r'C:\this\will\not\work\' ^ SyntaxError: unterminated string literal (detected at line 1) There are several workarounds for this. One is to use regular strings and double the backslashes::
trusted_official_docs
CPython Docs
>>> r'C:\this\will\not\work\' File "<stdin>", line 1 r'C:\this\will\not\work\' ^ SyntaxError: unterminated string literal (detected at line 1) There are several workarounds for this. One is to use regular strings and double the backslashes::
>>> r'C:\this\will\not\work\' File "<stdin>", line 1 r'C:\this\will\not\work\' ^ SyntaxError: unterminated string literal (detected at line 1) There are several workarounds for this. One is to use regular strings and double the backslashes::
python, official-docs, cpython, P0
Local_Trusted_Corpus
d3d48529-3a77-45a4-aeed-154e3aedccac
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,821
supabase-export-v2
42423c6d65264776
pass you a Python expression that might have unwanted side effects. For example, someone could pass ``__import__('os').system("rm -rf $HOME")`` which would erase your home directory. :func:`eval` also has the effect of interpreting numbers as Python expressions, so that, for example, ``eval('09')`` gives a syntax error...
trusted_official_docs
CPython Docs
pass you a Python expression that might have unwanted side effects. For example, someone could pass ``__import__('os').system("rm -rf $HOME")`` which would erase your home directory. :func:`eval` also has the effect of interpreting numbers as Python expressions, so that, for example, ``eval('09')`` gives a syntax error...
pass you a Python expression that might have unwanted side effects. For example, someone could pass ``__import__('os').system("rm -rf $HOME")`` which would erase your home directory. :func:`eval` also has the effect of interpreting numbers as Python expressions, so that, for example, ``eval('09')`` gives a syntax error...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d44e8f55-cbe1-4e8c-9eb5-ca6e45d3ef66
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,718
supabase-export-v2
64a1282af3835f2c
There are two factors that produce this result: 1) Variables are simply names that refer to objects. Doing ``y = x`` doesn't create a copy of the list -- it creates a new variable ``y`` that refers to the same object ``x`` refers to. This means that there is only one object (the list), and both ``x`` and ``y`` refer...
trusted_official_docs
CPython Docs
There are two factors that produce this result: 1) Variables are simply names that refer to objects. Doing ``y = x`` doesn't create a copy of the list -- it creates a new variable ``y`` that refers to the same object ``x`` refers to. This means that there is only one object (the list), and both ``x`` and ``y`` refer...
There are two factors that produce this result: 1) Variables are simply names that refer to objects. Doing ``y = x`` doesn't create a copy of the list -- it creates a new variable ``y`` that refers to the same object ``x`` refers to. This means that there is only one object (the list), and both ``x`` and ``y`` refer...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d4ea14d0-6722-4e24-8e8d-6703eef6f384
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,723
supabase-export-v2
333224863c937d45
two objects (the ints ``6`` and ``5``) and two variables that refer to them (``x`` now refers to ``6`` but ``y`` still refers to ``5``). Some operations (for example ``y.append(10)`` and ``y.sort()``) mutate the object, whereas superficially similar operations (for example ``y = y + [10]`` and :func:`sorted(y) <sorted>...
trusted_official_docs
CPython Docs
two objects (the ints ``6`` and ``5``) and two variables that refer to them (``x`` now refers to ``6`` but ``y`` still refers to ``5``). Some operations (for example ``y.append(10)`` and ``y.sort()``) mutate the object, whereas superficially similar operations (for example ``y = y + [10]`` and :func:`sorted(y) <sorted>...
two objects (the ints ``6`` and ``5``) and two variables that refer to them (``x`` now refers to ``6`` but ``y`` still refers to ``5``). Some operations (for example ``y.append(10)`` and ``y.sort()``) mutate the object, whereas superficially similar operations (for example ``y = y + [10]`` and :func:`sorted(y) <sorted>...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d65aa51d-418a-4f0c-bec5-83fd462f2aa2
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,946
supabase-export-v2
f047a08db0ae8900
the computation, ``2``, to element ``0`` of the tuple, we get an error because we can't change what an element of a tuple points to. Under the covers, what this augmented assignment statement is doing is approximately this::
trusted_official_docs
CPython Docs
the computation, ``2``, to element ``0`` of the tuple, we get an error because we can't change what an element of a tuple points to. Under the covers, what this augmented assignment statement is doing is approximately this::
the computation, ``2``, to element ``0`` of the tuple, we get an error because we can't change what an element of a tuple points to. Under the covers, what this augmented assignment statement is doing is approximately this::
python, official-docs, cpython, P0
Local_Trusted_Corpus
d6c207eb-3e96-48a4-99f2-ebbcfa155def
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,868
supabase-export-v2
7f2334eee7a987c1
My program is too slow. How do I speed it up? --------------------------------------------- That's a tough one, in general. First, here is a list of things to remember before diving further:
trusted_official_docs
CPython Docs
My program is too slow. How do I speed it up? --------------------------------------------- That's a tough one, in general. First, here is a list of things to remember before diving further:
My program is too slow. How do I speed it up? --------------------------------------------- That's a tough one, in general. First, here is a list of things to remember before diving further:
python, official-docs, cpython, P0
Local_Trusted_Corpus
d8fca5f2-78cd-41ac-94c8-87e4b3b711fa
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
2,017
supabase-export-v2
0fdb10258394fabf
def getcount(self): return C.count # or return self.count ``c.count`` also refers to ``C.count`` for any ``c`` such that ``isinstance(c, C)`` holds, unless overridden by ``c`` itself or by some class on the base-class search path from ``c.__class__`` back to ``C``.
trusted_official_docs
CPython Docs
def getcount(self): return C.count # or return self.count ``c.count`` also refers to ``C.count`` for any ``c`` such that ``isinstance(c, C)`` holds, unless overridden by ``c`` itself or by some class on the base-class search path from ``c.__class__`` back to ``C``.
def getcount(self): return C.count # or return self.count ``c.count`` also refers to ``C.count`` for any ``c`` such that ``isinstance(c, C)`` holds, unless overridden by ``c`` itself or by some class on the base-class search path from ``c.__class__`` back to ``C``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
d9317e39-5688-4f14-a5b3-ae91ca685251
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,986
supabase-export-v2
9edefc12dcdeab99
def search(obj): if isinstance(obj, Mailbox): ... # code to search a mailbox elif isinstance(obj, Document): ... # code to search a document elif ... A better approach is to define a ``search()`` method on all the classes and just call it::
trusted_official_docs
CPython Docs
def search(obj): if isinstance(obj, Mailbox): ... # code to search a mailbox elif isinstance(obj, Document): ... # code to search a document elif ... A better approach is to define a ``search()`` method on all the classes and just call it::
def search(obj): if isinstance(obj, Mailbox): ... # code to search a mailbox elif isinstance(obj, Document): ... # code to search a document elif ... A better approach is to define a ``search()`` method on all the classes and just call it::
python, official-docs, cpython, P0
Local_Trusted_Corpus
d9a09450-728d-4ad6-8832-795441d35b9e
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,765
supabase-export-v2
dc4396ca72d0b287
How can I find the methods or attributes of an object? ------------------------------------------------------ For an instance ``x`` of a user-defined class, :func:`dir(x) <dir>` returns an alphabetized list of the names containing the instance attributes and methods and attributes defined by its class.
trusted_official_docs
CPython Docs
How can I find the methods or attributes of an object? ------------------------------------------------------ For an instance ``x`` of a user-defined class, :func:`dir(x) <dir>` returns an alphabetized list of the names containing the instance attributes and methods and attributes defined by its class.
How can I find the methods or attributes of an object? ------------------------------------------------------ For an instance ``x`` of a user-defined class, :func:`dir(x) <dir>` returns an alphabetized list of the names containing the instance attributes and methods and attributes defined by its class.
python, official-docs, cpython, P0
Local_Trusted_Corpus
daba07ad-0838-410d-98cf-e6ec0727472a
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,992
supabase-export-v2
87a35ba91679e294
new class that provides a new implementation of the method you're interested in changing and delegates all other methods to the corresponding method of ``x``. Python programmers can easily implement delegation. For example, the following class implements a class that behaves like a file but converts all written data to...
trusted_official_docs
CPython Docs
new class that provides a new implementation of the method you're interested in changing and delegates all other methods to the corresponding method of ``x``. Python programmers can easily implement delegation. For example, the following class implements a class that behaves like a file but converts all written data to...
new class that provides a new implementation of the method you're interested in changing and delegates all other methods to the corresponding method of ``x``. Python programmers can easily implement delegation. For example, the following class implements a class that behaves like a file but converts all written data to...
python, official-docs, cpython, P0
Local_Trusted_Corpus
db84d2b2-be6f-45d2-89ca-ed64c7709564
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,660
supabase-export-v2
8a0ecedc0a80eae9
to a built-in function or to a component of an imported module. This clutter would defeat the usefulness of the ``global`` declaration for identifying side-effects. Why do lambdas defined in a loop with different values all return the same result? ------------------------------------------------------------------------...
trusted_official_docs
CPython Docs
to a built-in function or to a component of an imported module. This clutter would defeat the usefulness of the ``global`` declaration for identifying side-effects. Why do lambdas defined in a loop with different values all return the same result? ------------------------------------------------------------------------...
to a built-in function or to a component of an imported module. This clutter would defeat the usefulness of the ``global`` declaration for identifying side-effects. Why do lambdas defined in a loop with different values all return the same result? ------------------------------------------------------------------------...
python, official-docs, cpython, P0
Local_Trusted_Corpus
dbb0125c-9a2a-4f9f-9067-7fd7b3c4caa2
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
2,102
supabase-export-v2
830106a7043f83d9
def current_temperature(self): "Latest hourly observation" # Do not cache this because old results # can be out of date. @cached_property def location(self): "Return the longitude/latitude coordinates of the station" # Result only depends on the station_id
trusted_official_docs
CPython Docs
def current_temperature(self): "Latest hourly observation" # Do not cache this because old results # can be out of date. @cached_property def location(self): "Return the longitude/latitude coordinates of the station" # Result only depends on the station_id
def current_temperature(self): "Latest hourly observation" # Do not cache this because old results # can be out of date. @cached_property def location(self): "Return the longitude/latitude coordinates of the station" # Result only depends on the station_id
python, official-docs, cpython, P0
Local_Trusted_Corpus
dc7d65f1-8366-4d1e-9532-e18cfe4f4991
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
2,050
supabase-export-v2
baf6646f3ea48e73
objects without incrementing their reference count. Tree data structures, for instance, should use weak references for their parent and sibling references (if they need them!). .. XXX relevant for Python 3?
trusted_official_docs
CPython Docs
objects without incrementing their reference count. Tree data structures, for instance, should use weak references for their parent and sibling references (if they need them!). .. XXX relevant for Python 3?
objects without incrementing their reference count. Tree data structures, for instance, should use weak references for their parent and sibling references (if they need them!). .. XXX relevant for Python 3?
python, official-docs, cpython, P0
Local_Trusted_Corpus
dc86c502-095a-4ecd-98bd-388f17d5603a
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
2,041
supabase-export-v2
795cf87260212407
four = 4 * A()._A__one() In particular, this does not guarantee privacy since an outside user can still deliberately access the private attribute; many Python programmers never bother to use private variable names at all.
trusted_official_docs
CPython Docs
four = 4 * A()._A__one() In particular, this does not guarantee privacy since an outside user can still deliberately access the private attribute; many Python programmers never bother to use private variable names at all.
four = 4 * A()._A__one() In particular, this does not guarantee privacy since an outside user can still deliberately access the private attribute; many Python programmers never bother to use private variable names at all.
python, official-docs, cpython, P0
Local_Trusted_Corpus
dcc53bbf-adbf-4ec7-b19f-bb901d47a2ee
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,772
supabase-export-v2
a0f876c0a9d6465f
In comp.lang.python, Fredrik Lundh once gave an excellent analogy in answer to this question: The same way as you get the name of that cat you found on your porch: the cat (object) itself cannot tell you its name, and it doesn't really care -- so the only way to find out what it's called is to ask all your neighbours...
trusted_official_docs
CPython Docs
In comp.lang.python, Fredrik Lundh once gave an excellent analogy in answer to this question: The same way as you get the name of that cat you found on your porch: the cat (object) itself cannot tell you its name, and it doesn't really care -- so the only way to find out what it's called is to ask all your neighbours...
In comp.lang.python, Fredrik Lundh once gave an excellent analogy in answer to this question: The same way as you get the name of that cat you found on your porch: the cat (object) itself cannot tell you its name, and it doesn't really care -- so the only way to find out what it's called is to ask all your neighbours...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ddace9b8-73e6-4218-bb9a-5dd15c407950
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,811
supabase-export-v2
889a0cbdf2573487
requires that identity to hold, and then compilers that truncate ``i // j`` need to make ``i % j`` have the same sign as ``i``. There are few real use cases for ``i % j`` when ``j`` is negative. When ``j`` is positive, there are many, and in virtually all of them it's more useful for ``i % j`` to be ``>= 0``. If the cl...
trusted_official_docs
CPython Docs
requires that identity to hold, and then compilers that truncate ``i // j`` need to make ``i % j`` have the same sign as ``i``. There are few real use cases for ``i % j`` when ``j`` is negative. When ``j`` is positive, there are many, and in virtually all of them it's more useful for ``i % j`` to be ``>= 0``. If the cl...
requires that identity to hold, and then compilers that truncate ``i // j`` need to make ``i % j`` have the same sign as ``i``. There are few real use cases for ``i % j`` when ``j`` is negative. When ``j`` is positive, there are many, and in virtually all of them it's more useful for ``i % j`` to be ``>= 0``. If the cl...
python, official-docs, cpython, P0
Local_Trusted_Corpus
dea4e818-792f-4f8a-b696-c2cc605ddaa7
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,620
supabase-export-v2
e3d05845a08d6ef3
and is :mod:`documented in the Library Reference Manual <pdb>`. You can also write your own debugger by using the code for pdb as an example. The IDLE interactive development environment, which is part of the standard Python distribution (normally available as :mod:`idlelib`), includes a graphical debugger.
trusted_official_docs
CPython Docs
and is :mod:`documented in the Library Reference Manual <pdb>`. You can also write your own debugger by using the code for pdb as an example. The IDLE interactive development environment, which is part of the standard Python distribution (normally available as :mod:`idlelib`), includes a graphical debugger.
and is :mod:`documented in the Library Reference Manual <pdb>`. You can also write your own debugger by using the code for pdb as an example. The IDLE interactive development environment, which is part of the standard Python distribution (normally available as :mod:`idlelib`), includes a graphical debugger.
python, official-docs, cpython, P0
Local_Trusted_Corpus
df71307d-9f2c-49bd-bbe2-0b9c41e3cafc
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,729
supabase-export-v2
557f4697ef7a5e7e
How do I write a function with output parameters (call by reference)? --------------------------------------------------------------------- Remember that arguments are passed by assignment in Python. Since assignment just creates references to objects, there's no alias between an argument name in the caller and callee,...
trusted_official_docs
CPython Docs
How do I write a function with output parameters (call by reference)? --------------------------------------------------------------------- Remember that arguments are passed by assignment in Python. Since assignment just creates references to objects, there's no alias between an argument name in the caller and callee,...
How do I write a function with output parameters (call by reference)? --------------------------------------------------------------------- Remember that arguments are passed by assignment in Python. Since assignment just creates references to objects, there's no alias between an argument name in the caller and callee,...
python, official-docs, cpython, P0
Local_Trusted_Corpus
dffc5951-48b7-4049-8d11-06c9ec679481
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,849
supabase-export-v2
530d5564913222d4
Not as such. For simple input parsing, the easiest approach is usually to split the line into whitespace-delimited words using the :meth:`~str.split` method of string objects and then convert decimal strings to numeric values using :func:`int` or :func:`float`. :meth:`!split` supports an optional "sep" parameter which ...
trusted_official_docs
CPython Docs
Not as such. For simple input parsing, the easiest approach is usually to split the line into whitespace-delimited words using the :meth:`~str.split` method of string objects and then convert decimal strings to numeric values using :func:`int` or :func:`float`. :meth:`!split` supports an optional "sep" parameter which ...
Not as such. For simple input parsing, the easiest approach is usually to split the line into whitespace-delimited words using the :meth:`~str.split` method of string objects and then convert decimal strings to numeric values using :func:`int` or :func:`float`. :meth:`!split` supports an optional "sep" parameter which ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e06513e9-44d4-4044-8e6b-3f066d250f2f
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
2,046
supabase-export-v2
69e6daf2733f1223
There are several possible reasons for this. The :keyword:`del` statement does not necessarily call :meth:`~object.__del__` -- it simply decrements the object's reference count, and if this reaches zero :meth:`!__del__` is called.
trusted_official_docs
CPython Docs
There are several possible reasons for this. The :keyword:`del` statement does not necessarily call :meth:`~object.__del__` -- it simply decrements the object's reference count, and if this reaches zero :meth:`!__del__` is called.
There are several possible reasons for this. The :keyword:`del` statement does not necessarily call :meth:`~object.__del__` -- it simply decrements the object's reference count, and if this reaches zero :meth:`!__del__` is called.
python, official-docs, cpython, P0
Local_Trusted_Corpus
e0b30bd7-341a-419d-b3db-9118a775456d
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,658
supabase-export-v2
38742ff85702f778
What are the rules for local and global variables in Python? ------------------------------------------------------------ In Python, variables that are only referenced inside a function are implicitly global. If a variable is assigned a value anywhere within the function's body, it's assumed to be a local unless explic...
trusted_official_docs
CPython Docs
What are the rules for local and global variables in Python? ------------------------------------------------------------ In Python, variables that are only referenced inside a function are implicitly global. If a variable is assigned a value anywhere within the function's body, it's assumed to be a local unless explic...
What are the rules for local and global variables in Python? ------------------------------------------------------------ In Python, variables that are only referenced inside a function are implicitly global. If a variable is assigned a value anywhere within the function's body, it's assumed to be a local unless explic...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e0b67078-edda-4941-b360-c2a51d2d6999
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,727
supabase-export-v2
eca78f4acdc23e6a
that refer to it will always see the same value, but operations that transform that value into a new value always return a new object. If you want to know if two variables refer to the same object or not, you can use the :keyword:`is` operator, or the built-in function :func:`id`.
trusted_official_docs
CPython Docs
that refer to it will always see the same value, but operations that transform that value into a new value always return a new object. If you want to know if two variables refer to the same object or not, you can use the :keyword:`is` operator, or the built-in function :func:`id`.
that refer to it will always see the same value, but operations that transform that value into a new value always return a new object. If you want to know if two variables refer to the same object or not, you can use the :keyword:`is` operator, or the built-in function :func:`id`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
e3487491-10f1-4c7f-ad9d-20a49c1129ce
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,991
supabase-export-v2
66137b210a863628
What is delegation? ------------------- Delegation is an object-oriented technique (also called a design pattern). Let's say you have an object ``x`` and want to change the behaviour of just one of its methods. You can create a new class that provides a new implementation of the method you're interested in changing and...
trusted_official_docs
CPython Docs
What is delegation? ------------------- Delegation is an object-oriented technique (also called a design pattern). Let's say you have an object ``x`` and want to change the behaviour of just one of its methods. You can create a new class that provides a new implementation of the method you're interested in changing and...
What is delegation? ------------------- Delegation is an object-oriented technique (also called a design pattern). Let's say you have an object ``x`` and want to change the behaviour of just one of its methods. You can create a new class that provides a new implementation of the method you're interested in changing and...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e467e7f4-b01e-4a68-9596-03b9d39955c9
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
2,153
supabase-export-v2
d05ff47072aa9a52
from modname import some_objects will continue to work with the old version of the imported objects. If the module contains class definitions, existing class instances will *not* be updated to use the new class definition. This can result in the following paradoxical behaviour::
trusted_official_docs
CPython Docs
from modname import some_objects will continue to work with the old version of the imported objects. If the module contains class definitions, existing class instances will *not* be updated to use the new class definition. This can result in the following paradoxical behaviour::
from modname import some_objects will continue to work with the old version of the imported objects. If the module contains class definitions, existing class instances will *not* be updated to use the new class definition. This can result in the following paradoxical behaviour::
python, official-docs, cpython, P0
Local_Trusted_Corpus
e5a4a934-405a-424b-b998-b7eb68acdd1c
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
2,087
supabase-export-v2
bed72a783ce185df
class FirstOfMonthDate(dt.date): "Always choose the first day of the month" def __new__(cls, year, month, day): return super().__new__(cls, year, month, 1) class NamedInt(int): "Allow text names for some numbers" xlat = {'zero': 0, 'one': 1, 'ten': 10} def __new__(cls, value): value = cls.xlat.get(value, value) re...
trusted_official_docs
CPython Docs
class FirstOfMonthDate(dt.date): "Always choose the first day of the month" def __new__(cls, year, month, day): return super().__new__(cls, year, month, 1) class NamedInt(int): "Allow text names for some numbers" xlat = {'zero': 0, 'one': 1, 'ten': 10} def __new__(cls, value): value = cls.xlat.get(value, value) re...
class FirstOfMonthDate(dt.date): "Always choose the first day of the month" def __new__(cls, year, month, day): return super().__new__(cls, year, month, 1) class NamedInt(int): "Allow text names for some numbers" xlat = {'zero': 0, 'one': 1, 'ten': 10} def __new__(cls, value): value = cls.xlat.get(value, value) re...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e6afa457-92ee-4f0a-9bf5-e6f5c9bbda58
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
2,013
supabase-export-v2
0d55142458868501
Both static data and static methods (in the sense of C++ or Java) are supported in Python. For static data, simply define a class attribute. To assign a new value to the attribute, you have to explicitly use the class name in the assignment::
trusted_official_docs
CPython Docs
Both static data and static methods (in the sense of C++ or Java) are supported in Python. For static data, simply define a class attribute. To assign a new value to the attribute, you have to explicitly use the class name in the assignment::
Both static data and static methods (in the sense of C++ or Java) are supported in Python. For static data, simply define a class attribute. To assign a new value to the attribute, you have to explicitly use the class name in the assignment::
python, official-docs, cpython, P0
Local_Trusted_Corpus
e7d79a05-1326-41be-9fe8-b8325b55e82b
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
2,080
supabase-export-v2
c38adba93cc41851
to augment equality tests with identity tests. This prevents the code from being confused by objects such as ``float('NaN')`` that are not equal to themselves. For example, here is the implementation of :meth:`!collections.abc.Sequence.__contains__`::
trusted_official_docs
CPython Docs
to augment equality tests with identity tests. This prevents the code from being confused by objects such as ``float('NaN')`` that are not equal to themselves. For example, here is the implementation of :meth:`!collections.abc.Sequence.__contains__`::
to augment equality tests with identity tests. This prevents the code from being confused by objects such as ``float('NaN')`` that are not equal to themselves. For example, here is the implementation of :meth:`!collections.abc.Sequence.__contains__`::
python, official-docs, cpython, P0
Local_Trusted_Corpus
e8456ffc-8726-433d-8c60-970b39b683c2
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,813
supabase-export-v2
74b01403110a5e88
How do I get int literal attribute instead of SyntaxError? ---------------------------------------------------------- Trying to lookup an ``int`` literal attribute in the normal manner gives a :exc:`SyntaxError` because the period is seen as a decimal point::
trusted_official_docs
CPython Docs
How do I get int literal attribute instead of SyntaxError? ---------------------------------------------------------- Trying to lookup an ``int`` literal attribute in the normal manner gives a :exc:`SyntaxError` because the period is seen as a decimal point::
How do I get int literal attribute instead of SyntaxError? ---------------------------------------------------------- Trying to lookup an ``int`` literal attribute in the normal manner gives a :exc:`SyntaxError` because the period is seen as a decimal point::
python, official-docs, cpython, P0
Local_Trusted_Corpus
e9409532-378f-47ad-a2db-f0fa64d6a728
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,657
supabase-export-v2
9a2a1f7fb3b83396
... x = 10 ... def bar(): ... nonlocal x ... print(x) ... x += 1 ... bar() ... print(x) ... >>> foo() 10 11 What are the rules for local and global variables in Python? ------------------------------------------------------------
trusted_official_docs
CPython Docs
... x = 10 ... def bar(): ... nonlocal x ... print(x) ... x += 1 ... bar() ... print(x) ... >>> foo() 10 11 What are the rules for local and global variables in Python? ------------------------------------------------------------
... x = 10 ... def bar(): ... nonlocal x ... print(x) ... x += 1 ... bar() ... print(x) ... >>> foo() 10 11 What are the rules for local and global variables in Python? ------------------------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
e95f2ff6-705a-4989-b4e7-e005876d60fe
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,985
supabase-export-v2
ea67bd11f2fb4bfa
checking the object's class and doing a different thing based on what class it is. For example, if you have a function that does something:: def search(obj): if isinstance(obj, Mailbox): ... # code to search a mailbox elif isinstance(obj, Document): ... # code to search a document elif ...
trusted_official_docs
CPython Docs
checking the object's class and doing a different thing based on what class it is. For example, if you have a function that does something:: def search(obj): if isinstance(obj, Mailbox): ... # code to search a mailbox elif isinstance(obj, Document): ... # code to search a document elif ...
checking the object's class and doing a different thing based on what class it is. For example, if you have a function that does something:: def search(obj): if isinstance(obj, Mailbox): ... # code to search a mailbox elif isinstance(obj, Document): ... # code to search a document elif ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e9c448ed-8877-4174-b44e-64787e1e3c47
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,669
supabase-export-v2
5bfecb5551759a34
>>> squares = [] >>> for x in range(5): ... squares.append(lambda n=x: n**2) Here, ``n=x`` creates a new variable ``n`` local to the lambda and computed when the lambda is defined so that it has the same value that ``x`` had at that point in the loop. This means that the value of ``n`` will be ``0`` in the first lambda...
trusted_official_docs
CPython Docs
>>> squares = [] >>> for x in range(5): ... squares.append(lambda n=x: n**2) Here, ``n=x`` creates a new variable ``n`` local to the lambda and computed when the lambda is defined so that it has the same value that ``x`` had at that point in the loop. This means that the value of ``n`` will be ``0`` in the first lambda...
>>> squares = [] >>> for x in range(5): ... squares.append(lambda n=x: n**2) Here, ``n=x`` creates a new variable ``n`` local to the lambda and computed when the lambda is defined so that it has the same value that ``x`` had at that point in the loop. This means that the value of ``n`` will be ``0`` in the first lambda...
python, official-docs, cpython, P0
Local_Trusted_Corpus
eb16ed40-e316-4d42-a786-f83dc84e2bbe
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,970
supabase-export-v2
104eeb894594a087
a generic ``Mailbox`` class that provides basic accessor methods for a mailbox, and subclasses such as ``MboxMailbox``, ``MaildirMailbox``, ``OutlookMailbox`` that handle various specific mailbox formats. What is a method? -----------------
trusted_official_docs
CPython Docs
a generic ``Mailbox`` class that provides basic accessor methods for a mailbox, and subclasses such as ``MboxMailbox``, ``MaildirMailbox``, ``OutlookMailbox`` that handle various specific mailbox formats. What is a method? -----------------
a generic ``Mailbox`` class that provides basic accessor methods for a mailbox, and subclasses such as ``MboxMailbox``, ``MaildirMailbox``, ``OutlookMailbox`` that handle various specific mailbox formats. What is a method? -----------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
ec148989-e41f-4318-a23c-4e33b79e9ad4
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
2,143
supabase-export-v2
937dc157ab28eaf7
Van Rossum doesn't like this approach much because the imports appear in a strange place, but it does work. Matthias Urlichs recommends restructuring your code so that the recursive import is not necessary in the first place.
trusted_official_docs
CPython Docs
Van Rossum doesn't like this approach much because the imports appear in a strange place, but it does work. Matthias Urlichs recommends restructuring your code so that the recursive import is not necessary in the first place.
Van Rossum doesn't like this approach much because the imports appear in a strange place, but it does work. Matthias Urlichs recommends restructuring your code so that the recursive import is not necessary in the first place.
python, official-docs, cpython, P0
Local_Trusted_Corpus
ece7cb84-9bab-4453-a8d0-35478e9d478a
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,703
supabase-export-v2
a70f92a2d9451369
How can I pass optional or keyword parameters from one function to another? --------------------------------------------------------------------------- Collect the arguments using the ``*`` and ``**`` specifiers in the function's parameter list; this gives you the positional arguments as a tuple and the keyword argumen...
trusted_official_docs
CPython Docs
How can I pass optional or keyword parameters from one function to another? --------------------------------------------------------------------------- Collect the arguments using the ``*`` and ``**`` specifiers in the function's parameter list; this gives you the positional arguments as a tuple and the keyword argumen...
How can I pass optional or keyword parameters from one function to another? --------------------------------------------------------------------------- Collect the arguments using the ``*`` and ``**`` specifiers in the function's parameter list; this gives you the positional arguments as a tuple and the keyword argumen...
python, official-docs, cpython, P0
Local_Trusted_Corpus
eda83c76-2928-4cd3-8942-d140d13840a3
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,683
supabase-export-v2
77993b11a2aab595
It's good practice if you import modules in the following order: 1. standard library modules -- such as :mod:`sys`, :mod:`os`, :mod:`argparse`, :mod:`re` 2. third-party library modules (anything installed in Python's site-packages directory) -- such as :pypi:`dateutil`, :pypi:`requests`, :pypi:`tzdata` 3. locally deve...
trusted_official_docs
CPython Docs
It's good practice if you import modules in the following order: 1. standard library modules -- such as :mod:`sys`, :mod:`os`, :mod:`argparse`, :mod:`re` 2. third-party library modules (anything installed in Python's site-packages directory) -- such as :pypi:`dateutil`, :pypi:`requests`, :pypi:`tzdata` 3. locally deve...
It's good practice if you import modules in the following order: 1. standard library modules -- such as :mod:`sys`, :mod:`os`, :mod:`argparse`, :mod:`re` 2. third-party library modules (anything installed in Python's site-packages directory) -- such as :pypi:`dateutil`, :pypi:`requests`, :pypi:`tzdata` 3. locally deve...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ee9bc478-09fb-451c-acb5-f4e94af765b3
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,929
supabase-export-v2
014028379924b54f
A = [None] * 3 for i in range(3): A[i] = [None] * 2 This generates a list containing 3 different lists of length two. You can also use a list comprehension::
trusted_official_docs
CPython Docs
A = [None] * 3 for i in range(3): A[i] = [None] * 2 This generates a list containing 3 different lists of length two. You can also use a list comprehension::
A = [None] * 3 for i in range(3): A[i] = [None] * 2 This generates a list containing 3 different lists of length two. You can also use a list comprehension::
python, official-docs, cpython, P0
Local_Trusted_Corpus
ef65ebc8-4196-4e1f-8150-713bea89b3df
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,823
supabase-export-v2
0ed9da0749d3f610
How do I convert a number to a string? -------------------------------------- For example, to convert the number ``144`` to the string ``'144'``, use the built-in type constructor :func:`str`. If you want a hexadecimal or octal representation, use the built-in functions :func:`hex` or :func:`oct`. For fancy formatting,...
trusted_official_docs
CPython Docs
How do I convert a number to a string? -------------------------------------- For example, to convert the number ``144`` to the string ``'144'``, use the built-in type constructor :func:`str`. If you want a hexadecimal or octal representation, use the built-in functions :func:`hex` or :func:`oct`. For fancy formatting,...
How do I convert a number to a string? -------------------------------------- For example, to convert the number ``144`` to the string ``'144'``, use the built-in type constructor :func:`str`. If you want a hexadecimal or octal representation, use the built-in functions :func:`hex` or :func:`oct`. For fancy formatting,...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ef8dcdd7-dc24-450a-9e81-c40a042f253b
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,751
supabase-export-v2
7bc5f534d3d78c74
that it is a bit slower and results in slightly longer code. However, note that a collection of callables can share their signature via inheritance:: class exponential(linear): # __init__ inherited def __call__(self, x): return self.a * (x ** self.b)
trusted_official_docs
CPython Docs
that it is a bit slower and results in slightly longer code. However, note that a collection of callables can share their signature via inheritance:: class exponential(linear): # __init__ inherited def __call__(self, x): return self.a * (x ** self.b)
that it is a bit slower and results in slightly longer code. However, note that a collection of callables can share their signature via inheritance:: class exponential(linear): # __init__ inherited def __call__(self, x): return self.a * (x ** self.b)
python, official-docs, cpython, P0
Local_Trusted_Corpus
efbb6ec3-4977-4356-88e6-05fe9e6ed40c
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,810
supabase-export-v2
46d4c7cb14a6af46
i == (i // j) * j + (i % j) then integer division has to return the floor. C also requires that identity to hold, and then compilers that truncate ``i // j`` need to make ``i % j`` have the same sign as ``i``.
trusted_official_docs
CPython Docs
i == (i // j) * j + (i % j) then integer division has to return the floor. C also requires that identity to hold, and then compilers that truncate ``i // j`` need to make ``i % j`` have the same sign as ``i``.
i == (i // j) * j + (i % j) then integer division has to return the floor. C also requires that identity to hold, and then compilers that truncate ``i // j`` need to make ``i % j`` have the same sign as ``i``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
f1158ff8-1e87-4be1-8f39-2a514eabea35
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,738
supabase-export-v2
dc133076de1d5511
args['b'] = args['b'] + 1 # change it in-place ... >>> args = {'a': 'old-value', 'b': 99} >>> func3(args) >>> args {'a': 'new-value', 'b': 100} 5) Or bundle up values in a class instance::
trusted_official_docs
CPython Docs
args['b'] = args['b'] + 1 # change it in-place ... >>> args = {'a': 'old-value', 'b': 99} >>> func3(args) >>> args {'a': 'new-value', 'b': 100} 5) Or bundle up values in a class instance::
args['b'] = args['b'] + 1 # change it in-place ... >>> args = {'a': 'old-value', 'b': 99} >>> func3(args) >>> args {'a': 'new-value', 'b': 100} 5) Or bundle up values in a class instance::
python, official-docs, cpython, P0
Local_Trusted_Corpus
f28d7a37-4aaf-4b8c-8d8f-445bcbdab06d
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,721
supabase-export-v2
d53daded20364f35
If we instead assign an immutable object to ``x``:: >>> x = 5 # ints are immutable >>> y = x >>> x = x + 1 # 5 can't be mutated, we are creating a new object here >>> x 6 >>> y 5
trusted_official_docs
CPython Docs
If we instead assign an immutable object to ``x``:: >>> x = 5 # ints are immutable >>> y = x >>> x = x + 1 # 5 can't be mutated, we are creating a new object here >>> x 6 >>> y 5
If we instead assign an immutable object to ``x``:: >>> x = 5 # ints are immutable >>> y = x >>> x = x + 1 # 5 can't be mutated, we are creating a new object here >>> x 6 >>> y 5
python, official-docs, cpython, P0
Local_Trusted_Corpus
f392274f-717b-45ea-af5f-537195dccb05
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,873
supabase-export-v2
a8ac84e6cb1d22dd
* Use the right data structures. Study documentation for the :ref:`bltin-types` and the :mod:`collections` module. * When the standard library provides a primitive for doing something, it is likely (although not guaranteed) to be faster than any alternative you may come up with. This is doubly true for primitives wri...
trusted_official_docs
CPython Docs
* Use the right data structures. Study documentation for the :ref:`bltin-types` and the :mod:`collections` module. * When the standard library provides a primitive for doing something, it is likely (although not guaranteed) to be faster than any alternative you may come up with. This is doubly true for primitives wri...
* Use the right data structures. Study documentation for the :ref:`bltin-types` and the :mod:`collections` module. * When the standard library provides a primitive for doing something, it is likely (although not guaranteed) to be faster than any alternative you may come up with. This is doubly true for primitives wri...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f46f8e2a-4f52-4e60-8c68-b4ce113c2365
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,901
supabase-export-v2
90c9b9f1097ecd1a
If you don't mind reordering the list, sort it and then scan from the end of the list, deleting duplicates as you go:: if mylist: mylist.sort() last = mylist[-1] for i in range(len(mylist)-2, -1, -1): if last == mylist[i]: del mylist[i] else: last = mylist[i]
trusted_official_docs
CPython Docs
If you don't mind reordering the list, sort it and then scan from the end of the list, deleting duplicates as you go:: if mylist: mylist.sort() last = mylist[-1] for i in range(len(mylist)-2, -1, -1): if last == mylist[i]: del mylist[i] else: last = mylist[i]
If you don't mind reordering the list, sort it and then scan from the end of the list, deleting duplicates as you go:: if mylist: mylist.sort() last = mylist[-1] for i in range(len(mylist)-2, -1, -1): if last == mylist[i]: del mylist[i] else: last = mylist[i]
python, official-docs, cpython, P0
Local_Trusted_Corpus
f4779221-6433-4efb-9d90-9caffbacf720
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,786
supabase-export-v2
7a75caa9cb920ed7
[expression] and [on_true] or [on_false] However, this idiom is unsafe, as it can give wrong results when *on_true* has a false boolean value. Therefore, it is always better to use the ``... if ... else ...`` form.
trusted_official_docs
CPython Docs
[expression] and [on_true] or [on_false] However, this idiom is unsafe, as it can give wrong results when *on_true* has a false boolean value. Therefore, it is always better to use the ``... if ... else ...`` form.
[expression] and [on_true] or [on_false] However, this idiom is unsafe, as it can give wrong results when *on_true* has a false boolean value. Therefore, it is always better to use the ``... if ... else ...`` form.
python, official-docs, cpython, P0
Local_Trusted_Corpus
f4f6fe93-e04e-4818-b44e-f6b36422ed6b
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,726
supabase-export-v2
969332059ca58119
In other words: * If we have a mutable object (such as :class:`list`, :class:`dict`, :class:`set`), we can use some specific operations to mutate it and all the variables that refer to it will see the change. * If we have an immutable object (such as :class:`str`, :class:`int`, :class:`tuple`), all the variables tha...
trusted_official_docs
CPython Docs
In other words: * If we have a mutable object (such as :class:`list`, :class:`dict`, :class:`set`), we can use some specific operations to mutate it and all the variables that refer to it will see the change. * If we have an immutable object (such as :class:`str`, :class:`int`, :class:`tuple`), all the variables tha...
In other words: * If we have a mutable object (such as :class:`list`, :class:`dict`, :class:`set`), we can use some specific operations to mutate it and all the variables that refer to it will see the change. * If we have an immutable object (such as :class:`str`, :class:`int`, :class:`tuple`), all the variables tha...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f5bebac6-ba3d-4417-9d60-7ef70ac0a705
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,699
supabase-export-v2
03b188e2491c83b4
to the function, and return the cached value if the same value is requested again. This is called "memoizing", and can be implemented like this:: # Callers can only provide two parameters and optionally pass _cache by keyword def expensive(arg1, arg2, *, _cache={}): if (arg1, arg2) in _cache: return _cache[(arg1, ar...
trusted_official_docs
CPython Docs
to the function, and return the cached value if the same value is requested again. This is called "memoizing", and can be implemented like this:: # Callers can only provide two parameters and optionally pass _cache by keyword def expensive(arg1, arg2, *, _cache={}): if (arg1, arg2) in _cache: return _cache[(arg1, ar...
to the function, and return the cached value if the same value is requested again. This is called "memoizing", and can be implemented like this:: # Callers can only provide two parameters and optionally pass _cache by keyword def expensive(arg1, arg2, *, _cache={}): if (arg1, arg2) in _cache: return _cache[(arg1, ar...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f6313152-4bf0-4b89-b592-1b09cfababf1
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,978
supabase-export-v2
1d34cf66a13aa6e4
(class1, class2, ...))``, and can also check whether an object is one of Python's built-in types, for example, ``isinstance(obj, str)`` or ``isinstance(obj, (int, float, complex))``. Note that :func:`isinstance` also checks for virtual inheritance from an :term:`abstract base class`. So, the test will return ``True`` f...
trusted_official_docs
CPython Docs
(class1, class2, ...))``, and can also check whether an object is one of Python's built-in types, for example, ``isinstance(obj, str)`` or ``isinstance(obj, (int, float, complex))``. Note that :func:`isinstance` also checks for virtual inheritance from an :term:`abstract base class`. So, the test will return ``True`` f...
(class1, class2, ...))``, and can also check whether an object is one of Python's built-in types, for example, ``isinstance(obj, str)`` or ``isinstance(obj, (int, float, complex))``. Note that :func:`isinstance` also checks for virtual inheritance from an :term:`abstract base class`. So, the test will return ``True`` f...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f67cdef9-8e4b-438f-bbcd-13573c5fb971
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
2,051
supabase-export-v2
37044e8d7cb419ce
.. XXX relevant for Python 3? If the object has ever been a local variable in a function that caught an expression in an except clause, chances are that a reference to the object still exists in that function's stack frame as contained in the stack trace. Normally, calling :func:`sys.exc_clear` will take care of this...
trusted_official_docs
CPython Docs
.. XXX relevant for Python 3? If the object has ever been a local variable in a function that caught an expression in an except clause, chances are that a reference to the object still exists in that function's stack frame as contained in the stack trace. Normally, calling :func:`sys.exc_clear` will take care of this...
.. XXX relevant for Python 3? If the object has ever been a local variable in a function that caught an expression in an except clause, chances are that a reference to the object still exists in that function's stack frame as contained in the stack trace. Normally, calling :func:`sys.exc_clear` will take care of this...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f7da1e59-76cd-4791-afaf-343b468bca86
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,806
supabase-export-v2
78341b12c4ff6bfe
with a zero, and then a lower or uppercase "x". Hexadecimal digits can be specified in lower or uppercase. For example, in the Python interpreter:: >>> a = 0xa5 >>> a 165 >>> b = 0XB2 >>> b 178
trusted_official_docs
CPython Docs
with a zero, and then a lower or uppercase "x". Hexadecimal digits can be specified in lower or uppercase. For example, in the Python interpreter:: >>> a = 0xa5 >>> a 165 >>> b = 0XB2 >>> b 178
with a zero, and then a lower or uppercase "x". Hexadecimal digits can be specified in lower or uppercase. For example, in the Python interpreter:: >>> a = 0xa5 >>> a 165 >>> b = 0XB2 >>> b 178
python, official-docs, cpython, P0
Local_Trusted_Corpus
f906a144-e440-4c26-9307-cea9d7442f0f
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
2,055
supabase-export-v2
222847df6631bf91
a built-in type). You can program the class's constructor to keep track of all instances by keeping a list of weak references to each instance. Why does the result of ``id()`` appear to be not unique? --------------------------------------------------------
trusted_official_docs
CPython Docs
a built-in type). You can program the class's constructor to keep track of all instances by keeping a list of weak references to each instance. Why does the result of ``id()`` appear to be not unique? --------------------------------------------------------
a built-in type). You can program the class's constructor to keep track of all instances by keeping a list of weak references to each instance. Why does the result of ``id()`` appear to be not unique? --------------------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
fa95ee05-f1a3-483f-b283-2582e05f8cd9
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,787
supabase-export-v2
20d03a6d5e42dcd3
can give wrong results when *on_true* has a false boolean value. Therefore, it is always better to use the ``... if ... else ...`` form. Is it possible to write obfuscated one-liners in Python? --------------------------------------------------------
trusted_official_docs
CPython Docs
can give wrong results when *on_true* has a false boolean value. Therefore, it is always better to use the ``... if ... else ...`` form. Is it possible to write obfuscated one-liners in Python? --------------------------------------------------------
can give wrong results when *on_true* has a false boolean value. Therefore, it is always better to use the ``... if ... else ...`` form. Is it possible to write obfuscated one-liners in Python? --------------------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
fb063d0a-4639-4b7b-bd01-374d8f2792c6
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,856
supabase-export-v2
fee1a356f73bbfe0
A raw string ending with an odd number of backslashes will escape the string's quote:: >>> r'C:\this\will\not\work\' File "<stdin>", line 1 r'C:\this\will\not\work\' ^ SyntaxError: unterminated string literal (detected at line 1)
trusted_official_docs
CPython Docs
A raw string ending with an odd number of backslashes will escape the string's quote:: >>> r'C:\this\will\not\work\' File "<stdin>", line 1 r'C:\this\will\not\work\' ^ SyntaxError: unterminated string literal (detected at line 1)
A raw string ending with an odd number of backslashes will escape the string's quote:: >>> r'C:\this\will\not\work\' File "<stdin>", line 1 r'C:\this\will\not\work\' ^ SyntaxError: unterminated string literal (detected at line 1)
python, official-docs, cpython, P0
Local_Trusted_Corpus
fb4ae410-07ff-49e7-8c4c-5f9d6cc9a864
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,670
supabase-export-v2
16cd60fda5d1ffbf
``0`` in the first lambda, ``1`` in the second, ``2`` in the third, and so on. Therefore each lambda will now return the correct result:: >>> squares[2]() 4 >>> squares[4]() 16
trusted_official_docs
CPython Docs
``0`` in the first lambda, ``1`` in the second, ``2`` in the third, and so on. Therefore each lambda will now return the correct result:: >>> squares[2]() 4 >>> squares[4]() 16
``0`` in the first lambda, ``1`` in the second, ``2`` in the third, and so on. Therefore each lambda will now return the correct result:: >>> squares[2]() 4 >>> squares[4]() 16
python, official-docs, cpython, P0
Local_Trusted_Corpus
fbbacdab-3f3d-484a-97f8-60a67da298ac
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,796
supabase-export-v2
e3db356794079dae
What does the slash(/) in the parameter list of a function mean? ---------------------------------------------------------------- A slash in the argument list of a function denotes that the parameters prior to it are positional-only. Positional-only parameters are the ones without an externally usable name. Upon callin...
trusted_official_docs
CPython Docs
What does the slash(/) in the parameter list of a function mean? ---------------------------------------------------------------- A slash in the argument list of a function denotes that the parameters prior to it are positional-only. Positional-only parameters are the ones without an externally usable name. Upon callin...
What does the slash(/) in the parameter list of a function mean? ---------------------------------------------------------------- A slash in the argument list of a function denotes that the parameters prior to it are positional-only. Positional-only parameters are the ones without an externally usable name. Upon callin...
python, official-docs, cpython, P0
Local_Trusted_Corpus
fbc2c9a0-6e40-455e-a9df-d5f37bf5a983
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,709
supabase-export-v2
94da74d6c4bb83c0
actually passed to a function when calling it. Parameters define what :term:`kind of arguments <parameter>` a function can accept. For example, given the function definition:: def func(foo, bar=None, **kwargs): pass
trusted_official_docs
CPython Docs
actually passed to a function when calling it. Parameters define what :term:`kind of arguments <parameter>` a function can accept. For example, given the function definition:: def func(foo, bar=None, **kwargs): pass
actually passed to a function when calling it. Parameters define what :term:`kind of arguments <parameter>` a function can accept. For example, given the function definition:: def func(foo, bar=None, **kwargs): pass
python, official-docs, cpython, P0
Local_Trusted_Corpus
fd1b40ba-aa70-4b7b-82bd-65c26189d1f3
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,828
supabase-export-v2
f8cf06b381532ee5
import array >>> a = array.array('w', s) >>> print(a) array('w', 'Hello, world') >>> a[0] = 'y' >>> print(a) array('w', 'yello, world') >>> a.tounicode() 'yello, world' How do I use strings to call functions/methods? -----------------------------------------------
trusted_official_docs
CPython Docs
import array >>> a = array.array('w', s) >>> print(a) array('w', 'Hello, world') >>> a[0] = 'y' >>> print(a) array('w', 'yello, world') >>> a.tounicode() 'yello, world' How do I use strings to call functions/methods? -----------------------------------------------
import array >>> a = array.array('w', s) >>> print(a) array('w', 'Hello, world') >>> a[0] = 'y' >>> print(a) array('w', 'yello, world') >>> a.tounicode() 'yello, world' How do I use strings to call functions/methods? -----------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
fd60a1b9-034f-4434-bb51-06fdfd89ebcf
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,933
supabase-export-v2
7721fb5251b6e1e7
How do I apply a method or function to a sequence of objects? ------------------------------------------------------------- To call a method or function and accumulate the return values in a list, a :term:`list comprehension` is an elegant solution::
trusted_official_docs
CPython Docs
How do I apply a method or function to a sequence of objects? ------------------------------------------------------------- To call a method or function and accumulate the return values in a list, a :term:`list comprehension` is an elegant solution::
How do I apply a method or function to a sequence of objects? ------------------------------------------------------------- To call a method or function and accumulate the return values in a list, a :term:`list comprehension` is an elegant solution::
python, official-docs, cpython, P0
Local_Trusted_Corpus
fdc3f980-cbd0-4739-9215-4b1cc2667215
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,698
supabase-export-v2
342167bec562c60f
def foo(mydict=None): if mydict is None: mydict = {} # create a new dict for local namespace This feature can be useful. When you have a function that's time-consuming to compute, a common technique is to cache the parameters and the resulting value of each call to the function, and return the cached value if the same ...
trusted_official_docs
CPython Docs
def foo(mydict=None): if mydict is None: mydict = {} # create a new dict for local namespace This feature can be useful. When you have a function that's time-consuming to compute, a common technique is to cache the parameters and the resulting value of each call to the function, and return the cached value if the same ...
def foo(mydict=None): if mydict is None: mydict = {} # create a new dict for local namespace This feature can be useful. When you have a function that's time-consuming to compute, a common technique is to cache the parameters and the resulting value of each call to the function, and return the cached value if the same ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
fde38ce8-908e-4807-b137-b4cf3cbdb127
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
2,058
supabase-export-v2
254d1fd82a14b307
>>> id(1000) # doctest: +SKIP 13901272 >>> id(2000) # doctest: +SKIP 13901272 The two ids belong to different integer objects that are created before, and deleted immediately after execution of the ``id()`` call. To be sure that objects whose id you want to examine are still alive, create another reference to the objec...
trusted_official_docs
CPython Docs
>>> id(1000) # doctest: +SKIP 13901272 >>> id(2000) # doctest: +SKIP 13901272 The two ids belong to different integer objects that are created before, and deleted immediately after execution of the ``id()`` call. To be sure that objects whose id you want to examine are still alive, create another reference to the objec...
>>> id(1000) # doctest: +SKIP 13901272 >>> id(2000) # doctest: +SKIP 13901272 The two ids belong to different integer objects that are created before, and deleted immediately after execution of the ``id()`` call. To be sure that objects whose id you want to examine are still alive, create another reference to the objec...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ff85798d-e296-4026-9528-608d04350f86
CPython Docs
file://datasets/cpython/Doc/faq/programming.rst
unknown
edda7b58-bd69-4060-9295-d9036b4690eb
1,750
supabase-export-v2
f0f02d7624691dce
gives a callable object where ``taxes(10e6) == 0.3 * 10e6 + 2``. The callable object approach has the disadvantage that it is a bit slower and results in slightly longer code. However, note that a collection of callables can share their signature via inheritance::
trusted_official_docs
CPython Docs
gives a callable object where ``taxes(10e6) == 0.3 * 10e6 + 2``. The callable object approach has the disadvantage that it is a bit slower and results in slightly longer code. However, note that a collection of callables can share their signature via inheritance::
gives a callable object where ``taxes(10e6) == 0.3 * 10e6 + 2``. The callable object approach has the disadvantage that it is a bit slower and results in slightly longer code. However, note that a collection of callables can share their signature via inheritance::
python, official-docs, cpython, P0
Local_Trusted_Corpus
01624c9f-7f39-441e-b9f5-74ce528735e1
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,229
supabase-export-v2
b4cb0f6f1c62da46
run sequentially, one at a time! The reason is that the OS thread scheduler doesn't start a new thread until the previous thread is blocked. A simple fix is to add a tiny sleep to the start of the run function::
trusted_official_docs
CPython Docs
run sequentially, one at a time! The reason is that the OS thread scheduler doesn't start a new thread until the previous thread is blocked. A simple fix is to add a tiny sleep to the start of the run function::
run sequentially, one at a time! The reason is that the OS thread scheduler doesn't start a new thread until the previous thread is blocked. A simple fix is to add a tiny sleep to the start of the run function::
python, official-docs, cpython, P0
Local_Trusted_Corpus
034127ab-133d-487f-9d7a-9dcd94cf0a28
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,165
supabase-export-v2
25b5685eab78f457
you may not have the source file or it may be something like :file:`mathmodule.c`, somewhere in a C source directory (not on the Python Path). There are (at least) three kinds of modules in Python:
trusted_official_docs
CPython Docs
you may not have the source file or it may be something like :file:`mathmodule.c`, somewhere in a C source directory (not on the Python Path). There are (at least) three kinds of modules in Python:
you may not have the source file or it may be something like :file:`mathmodule.c`, somewhere in a C source directory (not on the Python Path). There are (at least) three kinds of modules in Python:
python, official-docs, cpython, P0
Local_Trusted_Corpus
0445ac4d-fc39-46b8-b9a6-980884c285a3
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,239
supabase-export-v2
872fdb88a7373a29
import threading, queue, time # The worker thread gets jobs off the queue. When the queue is empty, it # assumes there will be no more work and exits. # (Realistically workers will run until terminated.) def worker(): print('Running worker') time.sleep(0.1) while True: try: arg = q.get(block=False) except queue...
trusted_official_docs
CPython Docs
import threading, queue, time # The worker thread gets jobs off the queue. When the queue is empty, it # assumes there will be no more work and exits. # (Realistically workers will run until terminated.) def worker(): print('Running worker') time.sleep(0.1) while True: try: arg = q.get(block=False) except queue...
import threading, queue, time # The worker thread gets jobs off the queue. When the queue is empty, it # assumes there will be no more work and exits. # (Realistically workers will run until terminated.) def worker(): print('Running worker') time.sleep(0.1) while True: try: arg = q.get(block=False) except queue...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0718e91a-fd30-4a2b-b930-fa5c7f4a2087
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,161
supabase-export-v2
e4ad1c7b78efba7b
How do I find a module or application to perform task X? -------------------------------------------------------- Check :ref:`the Library Reference <library-index>` to see if there's a relevant standard library module. (Eventually you'll learn what's in the standard library and will be able to skip this step.)
trusted_official_docs
CPython Docs
How do I find a module or application to perform task X? -------------------------------------------------------- Check :ref:`the Library Reference <library-index>` to see if there's a relevant standard library module. (Eventually you'll learn what's in the standard library and will be able to skip this step.)
How do I find a module or application to perform task X? -------------------------------------------------------- Check :ref:`the Library Reference <library-index>` to see if there's a relevant standard library module. (Eventually you'll learn what's in the standard library and will be able to skip this step.)
python, official-docs, cpython, P0
Local_Trusted_Corpus
077dee93-22a4-4ec2-b5d8-4a7c84062565
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,176
supabase-export-v2
29a7b2e8f61ec223
#!/usr/bin/env python *Don't* do this for CGI scripts. The :envvar:`PATH` variable for CGI scripts is often very minimal, so you need to use the actual absolute pathname of the interpreter.
trusted_official_docs
CPython Docs
#!/usr/bin/env python *Don't* do this for CGI scripts. The :envvar:`PATH` variable for CGI scripts is often very minimal, so you need to use the actual absolute pathname of the interpreter.
#!/usr/bin/env python *Don't* do this for CGI scripts. The :envvar:`PATH` variable for CGI scripts is often very minimal, so you need to use the actual absolute pathname of the interpreter.
python, official-docs, cpython, P0
Local_Trusted_Corpus
0adbab53-c757-45fa-9108-50e1a3397c62
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,202
supabase-export-v2
94c69b9c7c0ab889
fun by writing your test functions in parallel with the "production code", since this makes it easy to find bugs and even design flaws earlier. "Support modules" that are not intended to be the main module of a program may include a self-test of the module. ::
trusted_official_docs
CPython Docs
fun by writing your test functions in parallel with the "production code", since this makes it easy to find bugs and even design flaws earlier. "Support modules" that are not intended to be the main module of a program may include a self-test of the module. ::
fun by writing your test functions in parallel with the "production code", since this makes it easy to find bugs and even design flaws earlier. "Support modules" that are not intended to be the main module of a program may include a self-test of the module. ::
python, official-docs, cpython, P0
Local_Trusted_Corpus
0c2abff9-86f5-42d0-88ec-f59d2f5e10ad
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,233
supabase-export-v2
ad185923361e9e13
time.sleep(10) Instead of trying to guess a good delay value for :func:`time.sleep`, it's better to use some kind of semaphore mechanism. One idea is to use the :mod:`queue` module to create a queue object, let each thread append a token to the queue when it finishes, and let the main thread read as many tokens from th...
trusted_official_docs
CPython Docs
time.sleep(10) Instead of trying to guess a good delay value for :func:`time.sleep`, it's better to use some kind of semaphore mechanism. One idea is to use the :mod:`queue` module to create a queue object, let each thread append a token to the queue when it finishes, and let the main thread read as many tokens from th...
time.sleep(10) Instead of trying to guess a good delay value for :func:`time.sleep`, it's better to use some kind of semaphore mechanism. One idea is to use the :mod:`queue` module to create a queue object, let each thread append a token to the queue when it finishes, and let the main thread read as many tokens from th...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0f729268-05d0-4b80-9697-838c1024dc1d
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,259
supabase-export-v2
3736c0690125f408
are fully understood. Python 3.13 is likely to be the first release containing this work, although it may not be completely functional in this release. The current work to remove the GIL is based on a `fork of Python 3.9 with the GIL removed <https://github.com/colesbury/nogil>`_ by Sam Gross. Prior to that, in the day...
trusted_official_docs
CPython Docs
are fully understood. Python 3.13 is likely to be the first release containing this work, although it may not be completely functional in this release. The current work to remove the GIL is based on a `fork of Python 3.9 with the GIL removed <https://github.com/colesbury/nogil>`_ by Sam Gross. Prior to that, in the day...
are fully understood. Python 3.13 is likely to be the first release containing this work, although it may not be completely functional in this release. The current work to remove the GIL is based on a `fork of Python 3.9 with the GIL removed <https://github.com/colesbury/nogil>`_ by Sam Gross. Prior to that, in the day...
python, official-docs, cpython, P0
Local_Trusted_Corpus
127a8195-6c8c-40b8-85f2-8ba88880c582
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,209
supabase-export-v2
fd58dc53ba935ed4
For Unix variants there are several solutions. It's straightforward to do this using curses, but curses is a fairly large module to learn. .. XXX this doesn't work out of the box, some IO expert needs to check why
trusted_official_docs
CPython Docs
For Unix variants there are several solutions. It's straightforward to do this using curses, but curses is a fairly large module to learn. .. XXX this doesn't work out of the box, some IO expert needs to check why
For Unix variants there are several solutions. It's straightforward to do this using curses, but curses is a fairly large module to learn. .. XXX this doesn't work out of the box, some IO expert needs to check why
python, official-docs, cpython, P0
Local_Trusted_Corpus
175eddd8-f03b-4a3c-b364-0ed1ddf070ba
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,283
supabase-export-v2
3d9182a8c5b63c4a
same type returned by the built-in :func:`open` function. Thus, to read *n* bytes from a pipe *p* created with :func:`os.popen`, you need to use ``p.read(n)``. How do I access the serial (RS232) port? ----------------------------------------
trusted_official_docs
CPython Docs
same type returned by the built-in :func:`open` function. Thus, to read *n* bytes from a pipe *p* created with :func:`os.popen`, you need to use ``p.read(n)``. How do I access the serial (RS232) port? ----------------------------------------
same type returned by the built-in :func:`open` function. Thus, to read *n* bytes from a pipe *p* created with :func:`os.popen`, you need to use ``p.read(n)``. How do I access the serial (RS232) port? ----------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
1d768111-eeb7-4256-9564-ec5f55af60e3
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,164
supabase-export-v2
3708fe4ffaa65fc9
Where is the math.py (socket.py, regex.py, etc.) source file? ------------------------------------------------------------- If you can't find a source file for a module it may be a built-in or dynamically loaded module implemented in C, C++ or other compiled language. In this case you may not have the source file or it...
trusted_official_docs
CPython Docs
Where is the math.py (socket.py, regex.py, etc.) source file? ------------------------------------------------------------- If you can't find a source file for a module it may be a built-in or dynamically loaded module implemented in C, C++ or other compiled language. In this case you may not have the source file or it...
Where is the math.py (socket.py, regex.py, etc.) source file? ------------------------------------------------------------- If you can't find a source file for a module it may be a built-in or dynamically loaded module implemented in C, C++ or other compiled language. In this case you may not have the source file or it...
python, official-docs, cpython, P0
Local_Trusted_Corpus
21a2fc7f-e163-45e7-aaa5-105629c29d49
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,257
supabase-export-v2
4a689c208f120a06
Can't we get rid of the Global Interpreter Lock? ------------------------------------------------ The :term:`global interpreter lock` (GIL) is often seen as a hindrance to Python's deployment on high-end multiprocessor server machines, because a multi-threaded Python program effectively only uses one CPU, due to the in...
trusted_official_docs
CPython Docs
Can't we get rid of the Global Interpreter Lock? ------------------------------------------------ The :term:`global interpreter lock` (GIL) is often seen as a hindrance to Python's deployment on high-end multiprocessor server machines, because a multi-threaded Python program effectively only uses one CPU, due to the in...
Can't we get rid of the Global Interpreter Lock? ------------------------------------------------ The :term:`global interpreter lock` (GIL) is often seen as a hindrance to Python's deployment on high-end multiprocessor server machines, because a multi-threaded Python program effectively only uses one CPU, due to the in...
python, official-docs, cpython, P0
Local_Trusted_Corpus
2dbcafeb-c034-47d6-8a63-f5b4f31c6b21
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,208
supabase-export-v2
2535c75a9979765b
How do I get a single keypress at a time? ----------------------------------------- For Unix variants there are several solutions. It's straightforward to do this using curses, but curses is a fairly large module to learn.
trusted_official_docs
CPython Docs
How do I get a single keypress at a time? ----------------------------------------- For Unix variants there are several solutions. It's straightforward to do this using curses, but curses is a fairly large module to learn.
How do I get a single keypress at a time? ----------------------------------------- For Unix variants there are several solutions. It's straightforward to do this using curses, but curses is a fairly large module to learn.
python, official-docs, cpython, P0
Local_Trusted_Corpus
309b94b1-a8d6-4d1c-acd0-819702021ca3
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,206
supabase-export-v2
013a060bf4ef287e
How do I create documentation from doc strings? ----------------------------------------------- The :mod:`pydoc` module can create HTML from the doc strings in your Python source code. An alternative for creating API documentation purely from docstrings is `epydoc <https://epydoc.sourceforge.net/>`_. `Sphinx <https://w...
trusted_official_docs
CPython Docs
How do I create documentation from doc strings? ----------------------------------------------- The :mod:`pydoc` module can create HTML from the doc strings in your Python source code. An alternative for creating API documentation purely from docstrings is `epydoc <https://epydoc.sourceforge.net/>`_. `Sphinx <https://w...
How do I create documentation from doc strings? ----------------------------------------------- The :mod:`pydoc` module can create HTML from the doc strings in your Python source code. An alternative for creating API documentation purely from docstrings is `epydoc <https://epydoc.sourceforge.net/>`_. `Sphinx <https://w...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3239bc47-aba0-467d-b265-c7f5ad6c65d6
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,307
supabase-export-v2
c1003aabccbc624f
import sys, smtplib fromaddr = input("From: ") toaddrs = input("To: ").split(',') print("Enter message, end with ^D:") msg = '' while True: line = sys.stdin.readline() if not line: break msg += line
trusted_official_docs
CPython Docs
import sys, smtplib fromaddr = input("From: ") toaddrs = input("To: ").split(',') print("Enter message, end with ^D:") msg = '' while True: line = sys.stdin.readline() if not line: break msg += line
import sys, smtplib fromaddr = input("From: ") toaddrs = input("To: ").split(',') print("Enter message, end with ^D:") msg = '' while True: line = sys.stdin.readline() if not line: break msg += line
python, official-docs, cpython, P0
Local_Trusted_Corpus
358ab5ed-e68a-4424-9c52-f1824d3e1fd5
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,195
supabase-export-v2
a8df693265a992ce
How do I test a Python program or component? -------------------------------------------- Python comes with two testing frameworks. The :mod:`doctest` module finds examples in the docstrings for a module and runs them, comparing the output with the expected output given in the docstring.
trusted_official_docs
CPython Docs
How do I test a Python program or component? -------------------------------------------- Python comes with two testing frameworks. The :mod:`doctest` module finds examples in the docstrings for a module and runs them, comparing the output with the expected output given in the docstring.
How do I test a Python program or component? -------------------------------------------- Python comes with two testing frameworks. The :mod:`doctest` module finds examples in the docstrings for a module and runs them, comparing the output with the expected output given in the docstring.
python, official-docs, cpython, P0
Local_Trusted_Corpus
35b3f4f4-cb75-4eed-bc4d-8fc38321f6f1
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,266
supabase-export-v2
a2315124568f574c
``os.unlink(filename)``; for documentation, see the :mod:`os` module. The two functions are identical; :func:`~os.unlink` is simply the name of the Unix system call for this function. To remove a directory, use :func:`os.rmdir`; use :func:`os.mkdir` to create one. ``os.makedirs(path)`` will create any intermediate dire...
trusted_official_docs
CPython Docs
``os.unlink(filename)``; for documentation, see the :mod:`os` module. The two functions are identical; :func:`~os.unlink` is simply the name of the Unix system call for this function. To remove a directory, use :func:`os.rmdir`; use :func:`os.mkdir` to create one. ``os.makedirs(path)`` will create any intermediate dire...
``os.unlink(filename)``; for documentation, see the :mod:`os` module. The two functions are identical; :func:`~os.unlink` is simply the name of the Unix system call for this function. To remove a directory, use :func:`os.rmdir`; use :func:`os.mkdir` to create one. ``os.makedirs(path)`` will create any intermediate dire...
python, official-docs, cpython, P0
Local_Trusted_Corpus
36d41937-dd15-4392-a117-f2bced8eb98c
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,267
supabase-export-v2
64619c31253fa480
exist. ``os.removedirs(path)`` will remove intermediate directories as long as they're empty; if you want to delete an entire directory tree and its contents, use :func:`shutil.rmtree`. To rename a file, use ``os.rename(old_path, new_path)``.
trusted_official_docs
CPython Docs
exist. ``os.removedirs(path)`` will remove intermediate directories as long as they're empty; if you want to delete an entire directory tree and its contents, use :func:`shutil.rmtree`. To rename a file, use ``os.rename(old_path, new_path)``.
exist. ``os.removedirs(path)`` will remove intermediate directories as long as they're empty; if you want to delete an entire directory tree and its contents, use :func:`shutil.rmtree`. To rename a file, use ``os.rename(old_path, new_path)``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
374bf1ed-97a7-4770-b5e4-973336d32573
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,333
supabase-export-v2
b91620197c05c423
* ``choice(S)`` chooses a random element from a given sequence. * ``shuffle(L)`` shuffles a list in-place, i.e. permutes it randomly. There's also a ``Random`` class you can instantiate to create independent multiple random number generators.
trusted_official_docs
CPython Docs
* ``choice(S)`` chooses a random element from a given sequence. * ``shuffle(L)`` shuffles a list in-place, i.e. permutes it randomly. There's also a ``Random`` class you can instantiate to create independent multiple random number generators.
* ``choice(S)`` chooses a random element from a given sequence. * ``shuffle(L)`` shuffles a list in-place, i.e. permutes it randomly. There's also a ``Random`` class you can instantiate to create independent multiple random number generators.
python, official-docs, cpython, P0
Local_Trusted_Corpus
38b55adc-075b-454c-8dfd-e4cbcb25b4a6
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,255
supabase-export-v2
82685e9b27561d6b
i = i+1 L.append(L[-1]) L[i] = L[j] D[x] = D[x] + 1 Operations that replace other objects may invoke those other objects' :meth:`~object.__del__` method when their reference count reaches zero, and that can affect things. This is especially true for the mass updates to dictionaries and lists. When in doubt, use a mutex...
trusted_official_docs
CPython Docs
i = i+1 L.append(L[-1]) L[i] = L[j] D[x] = D[x] + 1 Operations that replace other objects may invoke those other objects' :meth:`~object.__del__` method when their reference count reaches zero, and that can affect things. This is especially true for the mass updates to dictionaries and lists. When in doubt, use a mutex...
i = i+1 L.append(L[-1]) L[i] = L[j] D[x] = D[x] + 1 Operations that replace other objects may invoke those other objects' :meth:`~object.__del__` method when their reference count reaches zero, and that can affect things. This is especially true for the mass updates to dictionaries and lists. When in doubt, use a mutex...
python, official-docs, cpython, P0
Local_Trusted_Corpus
398545c1-70f6-4008-b437-7c5e237469ec
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,207
supabase-export-v2
05bb0da1f57d48b6
strings in your Python source code. An alternative for creating API documentation purely from docstrings is `epydoc <https://epydoc.sourceforge.net/>`_. `Sphinx <https://www.sphinx-doc.org>`_ can also include docstring content. How do I get a single keypress at a time? -----------------------------------------
trusted_official_docs
CPython Docs
strings in your Python source code. An alternative for creating API documentation purely from docstrings is `epydoc <https://epydoc.sourceforge.net/>`_. `Sphinx <https://www.sphinx-doc.org>`_ can also include docstring content. How do I get a single keypress at a time? -----------------------------------------
strings in your Python source code. An alternative for creating API documentation purely from docstrings is `epydoc <https://epydoc.sourceforge.net/>`_. `Sphinx <https://www.sphinx-doc.org>`_ can also include docstring content. How do I get a single keypress at a time? -----------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
3bc0e6d9-b5d8-4fbe-bcdc-7922c7b36db4
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,261
supabase-export-v2
f26f8838ab655acc
module provides an easy way of doing so; the :mod:`multiprocessing` module provides a lower-level API in case you want more control over dispatching of tasks. Judicious use of C extensions will also help; if you use a C extension to perform a time-consuming task, the extension can release the GIL while the thread of ex...
trusted_official_docs
CPython Docs
module provides an easy way of doing so; the :mod:`multiprocessing` module provides a lower-level API in case you want more control over dispatching of tasks. Judicious use of C extensions will also help; if you use a C extension to perform a time-consuming task, the extension can release the GIL while the thread of ex...
module provides an easy way of doing so; the :mod:`multiprocessing` module provides a lower-level API in case you want more control over dispatching of tasks. Judicious use of C extensions will also help; if you use a C extension to perform a time-consuming task, the extension can release the GIL while the thread of ex...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3db1fcf2-d738-4e82-beb0-229c859cef2d
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,215
supabase-export-v2
9be2bfeb8f8fa659
try: while True: try: c = sys.stdin.read(1) print("Got character", repr(c)) except OSError: pass finally: termios.tcsetattr(fd, termios.TCSAFLUSH, oldterm) fcntl.fcntl(fd, fcntl.F_SETFL, oldflags) You need the :mod:`termios` and the :mod:`fcntl` module for any of this to work, and I've only tried it on Linux, though i...
trusted_official_docs
CPython Docs
try: while True: try: c = sys.stdin.read(1) print("Got character", repr(c)) except OSError: pass finally: termios.tcsetattr(fd, termios.TCSAFLUSH, oldterm) fcntl.fcntl(fd, fcntl.F_SETFL, oldflags) You need the :mod:`termios` and the :mod:`fcntl` module for any of this to work, and I've only tried it on Linux, though i...
try: while True: try: c = sys.stdin.read(1) print("Got character", repr(c)) except OSError: pass finally: termios.tcsetattr(fd, termios.TCSAFLUSH, oldterm) fcntl.fcntl(fd, fcntl.F_SETFL, oldflags) You need the :mod:`termios` and the :mod:`fcntl` module for any of this to work, and I've only tried it on Linux, though i...
python, official-docs, cpython, P0
Local_Trusted_Corpus
40f5b399-0a6f-4a1c-9b04-7828b2b9e943
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,320
supabase-export-v2
1fbfcc433b0c2d02
Yes. Interfaces to disk-based hashes such as :mod:`DBM <dbm.ndbm>` and :mod:`GDBM <dbm.gnu>` are also included with standard Python. There is also the :mod:`sqlite3` module, which provides a lightweight disk-based relational database.
trusted_official_docs
CPython Docs
Yes. Interfaces to disk-based hashes such as :mod:`DBM <dbm.ndbm>` and :mod:`GDBM <dbm.gnu>` are also included with standard Python. There is also the :mod:`sqlite3` module, which provides a lightweight disk-based relational database.
Yes. Interfaces to disk-based hashes such as :mod:`DBM <dbm.ndbm>` and :mod:`GDBM <dbm.gnu>` are also included with standard Python. There is also the :mod:`sqlite3` module, which provides a lightweight disk-based relational database.
python, official-docs, cpython, P0
Local_Trusted_Corpus
41cea797-6d79-4f7d-bc9b-39cd706c1a8f
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,314
supabase-export-v2
59123f47d37f3deb
The :mod:`select` module is commonly used to help with asynchronous I/O on sockets. To prevent the TCP connect from blocking, you can set the socket to non-blocking mode. Then when you do the :meth:`~socket.socket.connect`, you will either connect immediately (unlikely) or get an exception that contains the error numbe...
trusted_official_docs
CPython Docs
The :mod:`select` module is commonly used to help with asynchronous I/O on sockets. To prevent the TCP connect from blocking, you can set the socket to non-blocking mode. Then when you do the :meth:`~socket.socket.connect`, you will either connect immediately (unlikely) or get an exception that contains the error numbe...
The :mod:`select` module is commonly used to help with asynchronous I/O on sockets. To prevent the TCP connect from blocking, you can set the socket to non-blocking mode. Then when you do the :meth:`~socket.socket.connect`, you will either connect immediately (unlikely) or get an exception that contains the error numbe...
python, official-docs, cpython, P0
Local_Trusted_Corpus
43228f9d-0075-44fb-832e-3c818f24c77f
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,186
supabase-export-v2
235dace96483659d
isn't compatible with operating systems that only have BSD curses, but there don't seem to be any currently maintained OSes that fall into this category. Is there an equivalent to C's onexit() in Python? -------------------------------------------------
trusted_official_docs
CPython Docs
isn't compatible with operating systems that only have BSD curses, but there don't seem to be any currently maintained OSes that fall into this category. Is there an equivalent to C's onexit() in Python? -------------------------------------------------
isn't compatible with operating systems that only have BSD curses, but there don't seem to be any currently maintained OSes that fall into this category. Is there an equivalent to C's onexit() in Python? -------------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
43668d4f-c842-457e-84cb-6de8a0a74b57
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,262
supabase-export-v2
0ce9202ea2466cd6
in the C code and allow other threads to get some work done. Some standard library modules such as :mod:`zlib` and :mod:`hashlib` already do this. An alternative approach to reducing the impact of the GIL is to make the GIL a per-interpreter-state lock rather than truly global. This was :ref:`first implemented in Pytho...
trusted_official_docs
CPython Docs
in the C code and allow other threads to get some work done. Some standard library modules such as :mod:`zlib` and :mod:`hashlib` already do this. An alternative approach to reducing the impact of the GIL is to make the GIL a per-interpreter-state lock rather than truly global. This was :ref:`first implemented in Pytho...
in the C code and allow other threads to get some work done. Some standard library modules such as :mod:`zlib` and :mod:`hashlib` already do this. An alternative approach to reducing the impact of the GIL is to make the GIL a per-interpreter-state lock rather than truly global. This was :ref:`first implemented in Pytho...
python, official-docs, cpython, P0
Local_Trusted_Corpus
436be96e-89fc-4f74-9f91-440fa1dffdb6
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,281
supabase-export-v2
e6f8835fc1a66cf9
If you use ``"r"`` instead (the default), the file will be open in text mode and ``f.read()`` will return :class:`str` objects rather than :class:`bytes` objects. I can't seem to use os.read() on a pipe created with os.popen(); why? ---------------------------------------------------------------------
trusted_official_docs
CPython Docs
If you use ``"r"`` instead (the default), the file will be open in text mode and ``f.read()`` will return :class:`str` objects rather than :class:`bytes` objects. I can't seem to use os.read() on a pipe created with os.popen(); why? ---------------------------------------------------------------------
If you use ``"r"`` instead (the default), the file will be open in text mode and ``f.read()`` will return :class:`str` objects rather than :class:`bytes` objects. I can't seem to use os.read() on a pipe created with os.popen(); why? ---------------------------------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
447490b5-0a6f-4e0b-a05a-eba9311becfa
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,330
supabase-export-v2
78c66ac2f20c1c52
There are also many other specialized generators in this module, such as: * ``randrange(a, b)`` chooses an integer in the range [a, b). * ``uniform(a, b)`` chooses a floating-point number in the range [a, b). * ``normalvariate(mean, sdev)`` samples the normal (Gaussian) distribution.
trusted_official_docs
CPython Docs
There are also many other specialized generators in this module, such as: * ``randrange(a, b)`` chooses an integer in the range [a, b). * ``uniform(a, b)`` chooses a floating-point number in the range [a, b). * ``normalvariate(mean, sdev)`` samples the normal (Gaussian) distribution.
There are also many other specialized generators in this module, such as: * ``randrange(a, b)`` chooses an integer in the range [a, b). * ``uniform(a, b)`` chooses a floating-point number in the range [a, b). * ``normalvariate(mean, sdev)`` samples the normal (Gaussian) distribution.
python, official-docs, cpython, P0
Local_Trusted_Corpus
44e7dec8-c3bd-4056-8d78-440dd68e0c1a
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,242
supabase-export-v2
f4610e26855398ce
# Start a pool of 5 workers for i in range(5): t = threading.Thread(target=worker, name='worker %i' % (i+1)) t.start() # Begin adding work to the queue for i in range(50): q.put(i)
trusted_official_docs
CPython Docs
# Start a pool of 5 workers for i in range(5): t = threading.Thread(target=worker, name='worker %i' % (i+1)) t.start() # Begin adding work to the queue for i in range(50): q.put(i)
# Start a pool of 5 workers for i in range(5): t = threading.Thread(target=worker, name='worker %i' % (i+1)) t.start() # Begin adding work to the queue for i in range(50): q.put(i)
python, official-docs, cpython, P0
Local_Trusted_Corpus
45f8519e-cc0f-4a8f-9365-6d9a5e636f93
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,309
supabase-export-v2
63dbc86b5741fb7b
# The actual mail send server = smtplib.SMTP('localhost') server.sendmail(fromaddr, toaddrs, msg) server.quit() A Unix-only alternative uses sendmail. The location of the sendmail program varies between systems; sometimes it is ``/usr/lib/sendmail``, sometimes ``/usr/sbin/sendmail``. The sendmail manual page will help ...
trusted_official_docs
CPython Docs
# The actual mail send server = smtplib.SMTP('localhost') server.sendmail(fromaddr, toaddrs, msg) server.quit() A Unix-only alternative uses sendmail. The location of the sendmail program varies between systems; sometimes it is ``/usr/lib/sendmail``, sometimes ``/usr/sbin/sendmail``. The sendmail manual page will help ...
# The actual mail send server = smtplib.SMTP('localhost') server.sendmail(fromaddr, toaddrs, msg) server.quit() A Unix-only alternative uses sendmail. The location of the sendmail program varies between systems; sometimes it is ``/usr/lib/sendmail``, sometimes ``/usr/sbin/sendmail``. The sendmail manual page will help ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4634ac82-f166-4205-9dd5-dad1eaffd96d
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,250
supabase-export-v2
a1cc4501d3bc3588
bytecode instruction and therefore all the C implementation code reached from each instruction is therefore atomic from the point of view of a Python program. In theory, this means an exact accounting requires an exact understanding of the PVM bytecode implementation. In practice, it means that operations on shared var...
trusted_official_docs
CPython Docs
bytecode instruction and therefore all the C implementation code reached from each instruction is therefore atomic from the point of view of a Python program. In theory, this means an exact accounting requires an exact understanding of the PVM bytecode implementation. In practice, it means that operations on shared var...
bytecode instruction and therefore all the C implementation code reached from each instruction is therefore atomic from the point of view of a Python program. In theory, this means an exact accounting requires an exact understanding of the PVM bytecode implementation. In practice, it means that operations on shared var...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4abd794c-0238-467b-bc9b-9e2079f28ceb
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,291
supabase-export-v2
da526acf62221aec
Python's point of view, and also arranges to close the underlying C file descriptor. This also happens automatically in ``f``'s destructor, when ``f`` becomes garbage. But stdin, stdout and stderr are treated specially by Python, because of the special status also given to them by C. Running ``sys.stdout.close()`` mark...
trusted_official_docs
CPython Docs
Python's point of view, and also arranges to close the underlying C file descriptor. This also happens automatically in ``f``'s destructor, when ``f`` becomes garbage. But stdin, stdout and stderr are treated specially by Python, because of the special status also given to them by C. Running ``sys.stdout.close()`` mark...
Python's point of view, and also arranges to close the underlying C file descriptor. This also happens automatically in ``f``'s destructor, when ``f`` becomes garbage. But stdin, stdout and stderr are treated specially by Python, because of the special status also given to them by C. Running ``sys.stdout.close()`` mark...
python, official-docs, cpython, P0
Local_Trusted_Corpus
526d3e29-067f-4794-adec-679748d72cc3
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,234
supabase-export-v2
8ae442fc160a36ed
append a token to the queue when it finishes, and let the main thread read as many tokens from the queue as there are threads. How do I parcel out work among a bunch of worker threads? ---------------------------------------------------------
trusted_official_docs
CPython Docs
append a token to the queue when it finishes, and let the main thread read as many tokens from the queue as there are threads. How do I parcel out work among a bunch of worker threads? ---------------------------------------------------------
append a token to the queue when it finishes, and let the main thread read as many tokens from the queue as there are threads. How do I parcel out work among a bunch of worker threads? ---------------------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
589b1709-d9eb-4ed1-824d-789a55d0790f
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,308
supabase-export-v2
41c176a60dee1f37
") toaddrs = input("To: ").split(',') print("Enter message, end with ^D:") msg = '' while True: line = sys.stdin.readline() if not line: break msg += line # The actual mail send server = smtplib.SMTP('localhost') server.sendmail(fromaddr, toaddrs, msg) server.quit()
trusted_official_docs
CPython Docs
") toaddrs = input("To: ").split(',') print("Enter message, end with ^D:") msg = '' while True: line = sys.stdin.readline() if not line: break msg += line # The actual mail send server = smtplib.SMTP('localhost') server.sendmail(fromaddr, toaddrs, msg) server.quit()
") toaddrs = input("To: ").split(',') print("Enter message, end with ^D:") msg = '' while True: line = sys.stdin.readline() if not line: break msg += line # The actual mail send server = smtplib.SMTP('localhost') server.sendmail(fromaddr, toaddrs, msg) server.quit()
python, official-docs, cpython, P0
Local_Trusted_Corpus
596652db-8923-4ed4-b248-885aee35306a
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,249
supabase-export-v2
796bec20226d669c
What kinds of global value mutation are thread-safe? ---------------------------------------------------- A :term:`global interpreter lock` (GIL) is used internally to ensure that only one thread runs in the Python VM at a time. In general, Python offers to switch among threads only between bytecode instructions; how f...
trusted_official_docs
CPython Docs
What kinds of global value mutation are thread-safe? ---------------------------------------------------- A :term:`global interpreter lock` (GIL) is used internally to ensure that only one thread runs in the Python VM at a time. In general, Python offers to switch among threads only between bytecode instructions; how f...
What kinds of global value mutation are thread-safe? ---------------------------------------------------- A :term:`global interpreter lock` (GIL) is used internally to ensure that only one thread runs in the Python VM at a time. In general, Python offers to switch among threads only between bytecode instructions; how f...
python, official-docs, cpython, P0
Local_Trusted_Corpus
5b358a47-3d88-46ed-937b-54c3ebd08f85
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,258
supabase-export-v2
d47b5f49e992db5e
multi-threaded Python program effectively only uses one CPU, due to the insistence that (almost) all Python code can only run while the GIL is held. With the approval of :pep:`703` work is now underway to remove the GIL from the CPython implementation of Python. Initially it will be implemented as an optional compiler ...
trusted_official_docs
CPython Docs
multi-threaded Python program effectively only uses one CPU, due to the insistence that (almost) all Python code can only run while the GIL is held. With the approval of :pep:`703` work is now underway to remove the GIL from the CPython implementation of Python. Initially it will be implemented as an optional compiler ...
multi-threaded Python program effectively only uses one CPU, due to the insistence that (almost) all Python code can only run while the GIL is held. With the approval of :pep:`703` work is now underway to remove the GIL from the CPython implementation of Python. Initially it will be implemented as an optional compiler ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
5c5a69fb-bf84-4645-9784-873aca5cc6f2
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,166
supabase-export-v2
cb9358100906fd5a
There are (at least) three kinds of modules in Python: 1) modules written in Python (.py); 2) modules written in C and dynamically loaded (.dll, .pyd, .so, .sl, etc); 3) modules written in C and linked with the interpreter; to get a list of these, type::
trusted_official_docs
CPython Docs
There are (at least) three kinds of modules in Python: 1) modules written in Python (.py); 2) modules written in C and dynamically loaded (.dll, .pyd, .so, .sl, etc); 3) modules written in C and linked with the interpreter; to get a list of these, type::
There are (at least) three kinds of modules in Python: 1) modules written in Python (.py); 2) modules written in C and dynamically loaded (.dll, .pyd, .so, .sl, etc); 3) modules written in C and linked with the interpreter; to get a list of these, type::
python, official-docs, cpython, P0
Local_Trusted_Corpus
5f6793c0-82ae-4994-bc35-928c884af01d
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,312
supabase-export-v2
f162dbea5b059d36
test\n") p.write("\n") # blank line separating headers from body p.write("Some text\n") p.write("some more text\n") sts = p.close() if sts != 0: print("Sendmail exit status", sts) How do I avoid blocking in the connect() method of a socket? ------------------------------------------------------------
trusted_official_docs
CPython Docs
test\n") p.write("\n") # blank line separating headers from body p.write("Some text\n") p.write("some more text\n") sts = p.close() if sts != 0: print("Sendmail exit status", sts) How do I avoid blocking in the connect() method of a socket? ------------------------------------------------------------
test\n") p.write("\n") # blank line separating headers from body p.write("Some text\n") p.write("some more text\n") sts = p.close() if sts != 0: print("Sendmail exit status", sts) How do I avoid blocking in the connect() method of a socket? ------------------------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
616129fa-e4bb-490f-9dbe-14d8cfb1ce1c
CPython Docs
file://datasets/cpython/Doc/faq/library.rst
unknown
0c83ebf1-858f-44b0-b8cc-ca00db2d367a
2,297
supabase-export-v2
933d9beb3c096b21
What WWW tools are there for Python? ------------------------------------ See the chapters titled :ref:`internet` and :ref:`netdata` in the Library Reference Manual. Python has many modules that will help you build server-side and client-side web systems.
trusted_official_docs
CPython Docs
What WWW tools are there for Python? ------------------------------------ See the chapters titled :ref:`internet` and :ref:`netdata` in the Library Reference Manual. Python has many modules that will help you build server-side and client-side web systems.
What WWW tools are there for Python? ------------------------------------ See the chapters titled :ref:`internet` and :ref:`netdata` in the Library Reference Manual. Python has many modules that will help you build server-side and client-side web systems.
python, official-docs, cpython, P0
Local_Trusted_Corpus