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
38eab365-c3d4-4e5f-a9c9-1ed33dddb580
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,549
supabase-export-v2
1d354e702b71d920
... No, really, it doesn't do anything: ... ... >>> my_function() ... >>> ... """ ... pass ... >>> print(my_function.__doc__) Do nothing, but document it. No, really, it doesn't do anything:
trusted_official_docs
CPython Docs
... No, really, it doesn't do anything: ... ... >>> my_function() ... >>> ... """ ... pass ... >>> print(my_function.__doc__) Do nothing, but document it. No, really, it doesn't do anything:
... No, really, it doesn't do anything: ... ... >>> my_function() ... >>> ... """ ... pass ... >>> print(my_function.__doc__) Do nothing, but document it. No, really, it doesn't do anything:
python, official-docs, cpython, P0
Local_Trusted_Corpus
3c71ec41-56f9-4ce7-bbe6-cd9edb90ccd6
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,359
supabase-export-v2
cd6c81de73c26a9a
>>> range(10) range(0, 10) In many ways the object returned by :func:`range` behaves as if it is a list, but in fact it isn't. It is an object which returns the successive items of the desired sequence when you iterate over it, but it doesn't really make the list, thus saving space.
trusted_official_docs
CPython Docs
>>> range(10) range(0, 10) In many ways the object returned by :func:`range` behaves as if it is a list, but in fact it isn't. It is an object which returns the successive items of the desired sequence when you iterate over it, but it doesn't really make the list, thus saving space.
>>> range(10) range(0, 10) In many ways the object returned by :func:`range` behaves as if it is a list, but in fact it isn't. It is an object which returns the successive items of the desired sequence when you iterate over it, but it doesn't really make the list, thus saving space.
python, official-docs, cpython, P0
Local_Trusted_Corpus
3f7603e1-bc28-470b-8552-78adfdc8ada4
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,554
supabase-export-v2
ce0122f312818f2d
:ref:`Function annotations <function>` are completely optional metadata information about the types used by user-defined functions (see :pep:`3107` and :pep:`484` for more information). :term:`Annotations <function annotation>` are stored in the :attr:`~object.__annotations__` attribute of the function as a dictionary ...
trusted_official_docs
CPython Docs
:ref:`Function annotations <function>` are completely optional metadata information about the types used by user-defined functions (see :pep:`3107` and :pep:`484` for more information). :term:`Annotations <function annotation>` are stored in the :attr:`~object.__annotations__` attribute of the function as a dictionary ...
:ref:`Function annotations <function>` are completely optional metadata information about the types used by user-defined functions (see :pep:`3107` and :pep:`484` for more information). :term:`Annotations <function annotation>` are stored in the :attr:`~object.__annotations__` attribute of the function as a dictionary ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
42009339-37e4-43cc-bb89-99520f328522
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,452
supabase-export-v2
dc4adc0c9dfdea9f
This example also introduces the :keyword:`in` keyword. This tests whether or not a sequence contains a certain value. The default values are evaluated at the point of function definition in the *defining* scope, so that ::
trusted_official_docs
CPython Docs
This example also introduces the :keyword:`in` keyword. This tests whether or not a sequence contains a certain value. The default values are evaluated at the point of function definition in the *defining* scope, so that ::
This example also introduces the :keyword:`in` keyword. This tests whether or not a sequence contains a certain value. The default values are evaluated at the point of function definition in the *defining* scope, so that ::
python, official-docs, cpython, P0
Local_Trusted_Corpus
44bce5e4-409b-4d0b-b9a2-e2b63cc6a157
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,565
supabase-export-v2
847922eb46952408
This helps users with small displays and makes it possible to have several code files side-by-side on larger displays. * Use blank lines to separate functions and classes, and larger blocks of code inside functions.
trusted_official_docs
CPython Docs
This helps users with small displays and makes it possible to have several code files side-by-side on larger displays. * Use blank lines to separate functions and classes, and larger blocks of code inside functions.
This helps users with small displays and makes it possible to have several code files side-by-side on larger displays. * Use blank lines to separate functions and classes, and larger blocks of code inside functions.
python, official-docs, cpython, P0
Local_Trusted_Corpus
44d6e9ed-a08d-4d19-bae2-d73935f719ad
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,338
supabase-export-v2
645c6842bfb50a8f
.. index:: pair: statement; for The :keyword:`for` statement in Python differs a bit from what you may be used to in C or Pascal. Rather than always iterating over an arithmetic progression of numbers (like in Pascal), or giving the user the ability to define both the iteration step and halting condition (as C), Python...
trusted_official_docs
CPython Docs
.. index:: pair: statement; for The :keyword:`for` statement in Python differs a bit from what you may be used to in C or Pascal. Rather than always iterating over an arithmetic progression of numbers (like in Pascal), or giving the user the ability to define both the iteration step and halting condition (as C), Python...
.. index:: pair: statement; for The :keyword:`for` statement in Python differs a bit from what you may be used to in C or Pascal. Rather than always iterating over an arithmetic progression of numbers (like in Pascal), or giving the user the ability to define both the iteration step and halting condition (as C), Python...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4518f811-e38f-4cce-9b7b-c1d322251351
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,483
supabase-export-v2
8dda9d4836cfecdb
f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2): ----------- ---------- ---------- | | | | Positional or keyword | | - Keyword only -- Positional only where ``/`` and ``*`` are optional. If used, these symbols indicate the kind of parameter by how the arguments may be passed to the function: positional-only, positional-or-...
trusted_official_docs
CPython Docs
f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2): ----------- ---------- ---------- | | | | Positional or keyword | | - Keyword only -- Positional only where ``/`` and ``*`` are optional. If used, these symbols indicate the kind of parameter by how the arguments may be passed to the function: positional-only, positional-or-...
f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2): ----------- ---------- ---------- | | | | Positional or keyword | | - Keyword only -- Positional only where ``/`` and ``*`` are optional. If used, these symbols indicate the kind of parameter by how the arguments may be passed to the function: positional-only, positional-or-...
python, official-docs, cpython, P0
Local_Trusted_Corpus
45c10f65-8881-4a23-8b3a-412616085b3e
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,463
supabase-export-v2
8b808ce2bf7349c1
Functions can also be called using :term:`keyword arguments <keyword argument>` of the form ``kwarg=value``. For instance, the following function:: def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'): print("-- This parrot wouldn't", action, end=' ') print("if you put", voltage, "volts through ...
trusted_official_docs
CPython Docs
Functions can also be called using :term:`keyword arguments <keyword argument>` of the form ``kwarg=value``. For instance, the following function:: def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'): print("-- This parrot wouldn't", action, end=' ') print("if you put", voltage, "volts through ...
Functions can also be called using :term:`keyword arguments <keyword argument>` of the form ``kwarg=value``. For instance, the following function:: def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'): print("-- This parrot wouldn't", action, end=' ') print("if you put", voltage, "volts through ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
476d02de-0fcd-494a-8fdb-544aeb3c9645
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,525
supabase-export-v2
eeff62f2402618ec
def write_multiple_items(file, separator, *args): file.write(separator.join(args)) Normally, these *variadic* arguments will be last in the list of formal parameters, because they scoop up all remaining input arguments that are passed to the function. Any formal parameters which occur after the ``*args`` parameter are ...
trusted_official_docs
CPython Docs
def write_multiple_items(file, separator, *args): file.write(separator.join(args)) Normally, these *variadic* arguments will be last in the list of formal parameters, because they scoop up all remaining input arguments that are passed to the function. Any formal parameters which occur after the ``*args`` parameter are ...
def write_multiple_items(file, separator, *args): file.write(separator.join(args)) Normally, these *variadic* arguments will be last in the list of formal parameters, because they scoop up all remaining input arguments that are passed to the function. Any formal parameters which occur after the ``*args`` parameter are ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
49ae8b52-44a2-4443-9597-600c33b782fc
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,553
supabase-export-v2
cb0819cb295fc774
.. index:: pair: function; annotations single: ->; function annotations single: : (colon); function annotations :ref:`Function annotations <function>` are completely optional metadata information about the types used by user-defined functions (see :pep:`3107` and :pep:`484` for more information).
trusted_official_docs
CPython Docs
.. index:: pair: function; annotations single: ->; function annotations single: : (colon); function annotations :ref:`Function annotations <function>` are completely optional metadata information about the types used by user-defined functions (see :pep:`3107` and :pep:`484` for more information).
.. index:: pair: function; annotations single: ->; function annotations single: : (colon); function annotations :ref:`Function annotations <function>` are completely optional metadata information about the types used by user-defined functions (see :pep:`3107` and :pep:`484` for more information).
python, official-docs, cpython, P0
Local_Trusted_Corpus
4b75e0b4-bfcb-43c5-a315-49a5a12ebbe6
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,451
supabase-export-v2
4fdcb49770c9adbb
arguments: ``ask_ok('OK to overwrite the file?', 2)`` * or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or no!')`` This example also introduces the :keyword:`in` keyword. This tests whether or not a sequence contains a certain value.
trusted_official_docs
CPython Docs
arguments: ``ask_ok('OK to overwrite the file?', 2)`` * or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or no!')`` This example also introduces the :keyword:`in` keyword. This tests whether or not a sequence contains a certain value.
arguments: ``ask_ok('OK to overwrite the file?', 2)`` * or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or no!')`` This example also introduces the :keyword:`in` keyword. This tests whether or not a sequence contains a certain value.
python, official-docs, cpython, P0
Local_Trusted_Corpus
4dea9802-6cad-4394-8c49-2136093885d6
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,413
supabase-export-v2
9fbcdef4b9e08284
tuple and list patterns have exactly the same meaning and actually match arbitrary sequences. An important exception is that they don't match iterators or strings. - Sequence patterns support extended unpacking: ``[x, y, *rest]`` and ``(x, y, *rest)`` work similar to unpacking assignments. The name after ``*`` may al...
trusted_official_docs
CPython Docs
tuple and list patterns have exactly the same meaning and actually match arbitrary sequences. An important exception is that they don't match iterators or strings. - Sequence patterns support extended unpacking: ``[x, y, *rest]`` and ``(x, y, *rest)`` work similar to unpacking assignments. The name after ``*`` may al...
tuple and list patterns have exactly the same meaning and actually match arbitrary sequences. An important exception is that they don't match iterators or strings. - Sequence patterns support extended unpacking: ``[x, y, *rest]`` and ``(x, y, *rest)`` work similar to unpacking assignments. The name after ``*`` may al...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4fad7940-fd2f-41cc-bd03-34d5a8fa0ccb
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,378
supabase-export-v2
e3d8c01d806658f9
(Yes, this is the correct code. Look closely: the ``else`` clause belongs to the ``for`` loop, **not** the ``if`` statement.) One way to think of the else clause is to imagine it paired with the ``if`` inside the loop. As the loop executes, it will run a sequence like if/if/if/else. The ``if`` is inside the loop, encou...
trusted_official_docs
CPython Docs
(Yes, this is the correct code. Look closely: the ``else`` clause belongs to the ``for`` loop, **not** the ``if`` statement.) One way to think of the else clause is to imagine it paired with the ``if`` inside the loop. As the loop executes, it will run a sequence like if/if/if/else. The ``if`` is inside the loop, encou...
(Yes, this is the correct code. Look closely: the ``else`` clause belongs to the ``for`` loop, **not** the ``if`` statement.) One way to think of the else clause is to imagine it paired with the ``if`` inside the loop. As the loop executes, it will run a sequence like if/if/if/else. The ``if`` is inside the loop, encou...
python, official-docs, cpython, P0
Local_Trusted_Corpus
50385446-0f8c-421a-9578-adb90df82936
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,480
supabase-export-v2
3b14de7b4f621da6
that a developer need only look at the function definition to determine if items are passed by position, by position or keyword, or by keyword. A function definition may look like:
trusted_official_docs
CPython Docs
that a developer need only look at the function definition to determine if items are passed by position, by position or keyword, or by keyword. A function definition may look like:
that a developer need only look at the function definition to determine if items are passed by position, by position or keyword, or by keyword. A function definition may look like:
python, official-docs, cpython, P0
Local_Trusted_Corpus
541ace44-3e21-4b07-84c9-df298f7402ee
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,467
supabase-export-v2
2712e1e7bf2f8384
but all the following calls would be invalid:: parrot() # required argument missing parrot(voltage=5.0, 'dead') # non-keyword argument after a keyword argument parrot(110, voltage=220) # duplicate value for the same argument parrot(actor='John Cleese') # unknown keyword argument
trusted_official_docs
CPython Docs
but all the following calls would be invalid:: parrot() # required argument missing parrot(voltage=5.0, 'dead') # non-keyword argument after a keyword argument parrot(110, voltage=220) # duplicate value for the same argument parrot(actor='John Cleese') # unknown keyword argument
but all the following calls would be invalid:: parrot() # required argument missing parrot(voltage=5.0, 'dead') # non-keyword argument after a keyword argument parrot(110, voltage=220) # duplicate value for the same argument parrot(actor='John Cleese') # unknown keyword argument
python, official-docs, cpython, P0
Local_Trusted_Corpus
57019374-310b-40dd-bcc3-c356668f80fd
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,432
supabase-export-v2
e554e82b07f54268
(unless, for global variables, named in a :keyword:`global` statement, or, for variables of enclosing functions, named in a :keyword:`nonlocal` statement), although they may be referenced. The actual parameters (arguments) to a function call are introduced in the local symbol table of the called function when it is cal...
trusted_official_docs
CPython Docs
(unless, for global variables, named in a :keyword:`global` statement, or, for variables of enclosing functions, named in a :keyword:`nonlocal` statement), although they may be referenced. The actual parameters (arguments) to a function call are introduced in the local symbol table of the called function when it is cal...
(unless, for global variables, named in a :keyword:`global` statement, or, for variables of enclosing functions, named in a :keyword:`nonlocal` statement), although they may be referenced. The actual parameters (arguments) to a function call are introduced in the local symbol table of the called function when it is cal...
python, official-docs, cpython, P0
Local_Trusted_Corpus
57aab110-9037-4efc-aff3-55f89f2cfae9
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,361
supabase-export-v2
ab1debe63909ce9e
is exhausted. We have seen that the :keyword:`for` statement is such a construct, while an example of a function that takes an iterable is :func:`sum`:: >>> sum(range(4)) # 0 + 1 + 2 + 3 6
trusted_official_docs
CPython Docs
is exhausted. We have seen that the :keyword:`for` statement is such a construct, while an example of a function that takes an iterable is :func:`sum`:: >>> sum(range(4)) # 0 + 1 + 2 + 3 6
is exhausted. We have seen that the :keyword:`for` statement is such a construct, while an example of a function that takes an iterable is :func:`sum`:: >>> sum(range(4)) # 0 + 1 + 2 + 3 6
python, official-docs, cpython, P0
Local_Trusted_Corpus
58bbdc8e-c2c0-484e-b7f4-f7d096218a66
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,371
supabase-export-v2
12222d6403de62fb
:keyword:`!else` Clauses on Loops ================================= In a :keyword:`!for` or :keyword:`!while` loop the :keyword:`!break` statement may be paired with an :keyword:`!else` clause. If the loop finishes without executing the :keyword:`!break`, the :keyword:`!else` clause executes.
trusted_official_docs
CPython Docs
:keyword:`!else` Clauses on Loops ================================= In a :keyword:`!for` or :keyword:`!while` loop the :keyword:`!break` statement may be paired with an :keyword:`!else` clause. If the loop finishes without executing the :keyword:`!break`, the :keyword:`!else` clause executes.
:keyword:`!else` Clauses on Loops ================================= In a :keyword:`!for` or :keyword:`!while` loop the :keyword:`!break` statement may be paired with an :keyword:`!else` clause. If the loop finishes without executing the :keyword:`!break`, the :keyword:`!else` clause executes.
python, official-docs, cpython, P0
Local_Trusted_Corpus
5d584612-41c3-4a78-aea2-0080ed4f043b
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,509
supabase-export-v2
31921ed38ab6c18d
Finally, consider this function definition which has a potential collision between the positional argument ``name`` and ``**kwds`` which has ``name`` as a key:: def foo(name, **kwds): return 'name' in kwds
trusted_official_docs
CPython Docs
Finally, consider this function definition which has a potential collision between the positional argument ``name`` and ``**kwds`` which has ``name`` as a key:: def foo(name, **kwds): return 'name' in kwds
Finally, consider this function definition which has a potential collision between the positional argument ``name`` and ``**kwds`` which has ``name`` as a key:: def foo(name, **kwds): return 'name' in kwds
python, official-docs, cpython, P0
Local_Trusted_Corpus
5fb6bd1b-327d-4d43-bf64-fd4be716fd78
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,539
supabase-export-v2
37e2e7e305d2d38c
use is to pass a small function as an argument. For instance, :meth:`list.sort` takes a sorting key function *key* which can be a lambda function:: >>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')] >>> pairs.sort(key=lambda pair: pair[1]) >>> pairs [(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]
trusted_official_docs
CPython Docs
use is to pass a small function as an argument. For instance, :meth:`list.sort` takes a sorting key function *key* which can be a lambda function:: >>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')] >>> pairs.sort(key=lambda pair: pair[1]) >>> pairs [(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]
use is to pass a small function as an argument. For instance, :meth:`list.sort` takes a sorting key function *key* which can be a lambda function:: >>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')] >>> pairs.sort(key=lambda pair: pair[1]) >>> pairs [(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]
python, official-docs, cpython, P0
Local_Trusted_Corpus
60c6ab52-2d10-4372-b449-2e52ea710d38
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,403
supabase-export-v2
7190ac2e200753a1
def where_is(point): match point: case Point(x=0, y=0): print("Origin") case Point(x=0, y=y): print(f"Y={y}") case Point(x=x, y=0): print(f"X={x}") case Point(): print("Somewhere else") case _: print("Not a point") You can use positional parameters with some builtin classes that provide an ordering for their attributes...
trusted_official_docs
CPython Docs
def where_is(point): match point: case Point(x=0, y=0): print("Origin") case Point(x=0, y=y): print(f"Y={y}") case Point(x=x, y=0): print(f"X={x}") case Point(): print("Somewhere else") case _: print("Not a point") You can use positional parameters with some builtin classes that provide an ordering for their attributes...
def where_is(point): match point: case Point(x=0, y=0): print("Origin") case Point(x=0, y=y): print(f"Y={y}") case Point(x=x, y=0): print(f"X={x}") case Point(): print("Somewhere else") case _: print("Not a point") You can use positional parameters with some builtin classes that provide an ordering for their attributes...
python, official-docs, cpython, P0
Local_Trusted_Corpus
62528916-d9e5-46bf-a25f-ff95ec7778fa
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,477
supabase-export-v2
62c8deca3583b451
Limburger It's very runny, sir. It's really very, VERY runny, sir. ---------------------------------------- shopkeeper : Michael Palin client : John Cleese sketch : Cheese Shop Sketch Note that the order in which the keyword arguments are printed is guaranteed to match the order in which they were provided in the funct...
trusted_official_docs
CPython Docs
Limburger It's very runny, sir. It's really very, VERY runny, sir. ---------------------------------------- shopkeeper : Michael Palin client : John Cleese sketch : Cheese Shop Sketch Note that the order in which the keyword arguments are printed is guaranteed to match the order in which they were provided in the funct...
Limburger It's very runny, sir. It's really very, VERY runny, sir. ---------------------------------------- shopkeeper : Michael Palin client : John Cleese sketch : Cheese Shop Sketch Note that the order in which the keyword arguments are printed is guaranteed to match the order in which they were provided in the funct...
python, official-docs, cpython, P0
Local_Trusted_Corpus
62730a21-3f7d-44f1-8ef3-bacdb63b51fe
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,373
supabase-export-v2
ca14cc7f607cd2e4
In a :keyword:`for` loop, the :keyword:`!else` clause is executed after the loop finishes its final iteration, that is, if no break occurred. In a :keyword:`while` loop, it's executed after the loop's condition becomes false.
trusted_official_docs
CPython Docs
In a :keyword:`for` loop, the :keyword:`!else` clause is executed after the loop finishes its final iteration, that is, if no break occurred. In a :keyword:`while` loop, it's executed after the loop's condition becomes false.
In a :keyword:`for` loop, the :keyword:`!else` clause is executed after the loop finishes its final iteration, that is, if no break occurred. In a :keyword:`while` loop, it's executed after the loop's condition becomes false.
python, official-docs, cpython, P0
Local_Trusted_Corpus
62f545db-9934-4baa-a981-da897fd375c7
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,513
supabase-export-v2
183e723fa5f2eb3b
using ``/`` (positional only arguments), it is possible since it allows ``name`` as a positional argument and ``'name'`` as a key in the keyword arguments:: >>> def foo(name, /, **kwds): ... return 'name' in kwds ... >>> foo(1, **{'name': 2}) True
trusted_official_docs
CPython Docs
using ``/`` (positional only arguments), it is possible since it allows ``name`` as a positional argument and ``'name'`` as a key in the keyword arguments:: >>> def foo(name, /, **kwds): ... return 'name' in kwds ... >>> foo(1, **{'name': 2}) True
using ``/`` (positional only arguments), it is possible since it allows ``name`` as a positional argument and ``'name'`` as a key in the keyword arguments:: >>> def foo(name, /, **kwds): ... return 'name' in kwds ... >>> foo(1, **{'name': 2}) True
python, official-docs, cpython, P0
Local_Trusted_Corpus
634da2f5-c852-422e-9a7b-14a4437b6a5b
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,387
supabase-export-v2
df426f915fe4cde3
or conditional body when you are working on new code, allowing you to keep thinking at a more abstract level. The :keyword:`!pass` is silently ignored:: >>> def initlog(*args): ... pass # Remember to implement this! ...
trusted_official_docs
CPython Docs
or conditional body when you are working on new code, allowing you to keep thinking at a more abstract level. The :keyword:`!pass` is silently ignored:: >>> def initlog(*args): ... pass # Remember to implement this! ...
or conditional body when you are working on new code, allowing you to keep thinking at a more abstract level. The :keyword:`!pass` is silently ignored:: >>> def initlog(*args): ... pass # Remember to implement this! ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
635194f0-a414-409e-b41d-0c967fb71819
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,401
supabase-export-v2
bfce4aa2fb7c9c37
your data you can use the class name followed by an argument list resembling a constructor, but with the ability to capture attributes into variables:: class Point: def __init__(self, x, y): self.x = x self.y = y
trusted_official_docs
CPython Docs
your data you can use the class name followed by an argument list resembling a constructor, but with the ability to capture attributes into variables:: class Point: def __init__(self, x, y): self.x = x self.y = y
your data you can use the class name followed by an argument list resembling a constructor, but with the ability to capture attributes into variables:: class Point: def __init__(self, x, y): self.x = x self.y = y
python, official-docs, cpython, P0
Local_Trusted_Corpus
698ae9e2-49c0-460b-96ee-a61af8aa0f2c
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,536
supabase-export-v2
7bb358793c308f5e
Lambda Expressions ------------------ Small anonymous functions can be created with the :keyword:`lambda` keyword. This function returns the sum of its two arguments: ``lambda a, b: a+b``. Lambda functions can be used wherever function objects are required. They are syntactically restricted to a single expression. Sema...
trusted_official_docs
CPython Docs
Lambda Expressions ------------------ Small anonymous functions can be created with the :keyword:`lambda` keyword. This function returns the sum of its two arguments: ``lambda a, b: a+b``. Lambda functions can be used wherever function objects are required. They are syntactically restricted to a single expression. Sema...
Lambda Expressions ------------------ Small anonymous functions can be created with the :keyword:`lambda` keyword. This function returns the sum of its two arguments: ``lambda a, b: a+b``. Lambda functions can be used wherever function objects are required. They are syntactically restricted to a single expression. Sema...
python, official-docs, cpython, P0
Local_Trusted_Corpus
74cfc91f-5f25-4567-ad88-b39652173384
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,345
supabase-export-v2
a2d39abf24c36488
# Strategy: Iterate over a copy for user, status in users.copy().items(): if status == 'inactive': del users[user] # Strategy: Create a new collection active_users = {} for user, status in users.items(): if status == 'active': active_users[user] = status
trusted_official_docs
CPython Docs
# Strategy: Iterate over a copy for user, status in users.copy().items(): if status == 'inactive': del users[user] # Strategy: Create a new collection active_users = {} for user, status in users.items(): if status == 'active': active_users[user] = status
# Strategy: Iterate over a copy for user, status in users.copy().items(): if status == 'inactive': del users[user] # Strategy: Create a new collection active_users = {} for user, status in users.items(): if status == 'active': active_users[user] = status
python, official-docs, cpython, P0
Local_Trusted_Corpus
74e7240c-8702-4121-8e42-235d3187b5e5
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,447
supabase-export-v2
dfff333f1079d21e
Default Argument Values ----------------------- The most useful form is to specify a default value for one or more arguments. This creates a function that can be called with fewer arguments than it is defined to allow. For example::
trusted_official_docs
CPython Docs
Default Argument Values ----------------------- The most useful form is to specify a default value for one or more arguments. This creates a function that can be called with fewer arguments than it is defined to allow. For example::
Default Argument Values ----------------------- The most useful form is to specify a default value for one or more arguments. This creates a function that can be called with fewer arguments than it is defined to allow. For example::
python, official-docs, cpython, P0
Local_Trusted_Corpus
75f7f3bf-b624-4908-b068-de85fb26f68a
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,374
supabase-export-v2
6cfa0e773de1b460
In a :keyword:`while` loop, it's executed after the loop's condition becomes false. In either kind of loop, the :keyword:`!else` clause is **not** executed if the loop was terminated by a :keyword:`break`. Of course, other ways of ending the loop early, such as a :keyword:`return` or a raised exception, will also skip ...
trusted_official_docs
CPython Docs
In a :keyword:`while` loop, it's executed after the loop's condition becomes false. In either kind of loop, the :keyword:`!else` clause is **not** executed if the loop was terminated by a :keyword:`break`. Of course, other ways of ending the loop early, such as a :keyword:`return` or a raised exception, will also skip ...
In a :keyword:`while` loop, it's executed after the loop's condition becomes false. In either kind of loop, the :keyword:`!else` clause is **not** executed if the loop was terminated by a :keyword:`break`. Of course, other ways of ending the loop early, such as a :keyword:`return` or a raised exception, will also skip ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7b80c0bd-0076-4ab6-a252-4a44869365c1
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,430
supabase-export-v2
7a3aefc16159d758
and the parenthesized list of formal parameters. The statements that form the body of the function start at the next line, and must be indented. The first statement of the function body can optionally be a string literal; this string literal is the function's documentation string, or :dfn:`docstring`. (More about docst...
trusted_official_docs
CPython Docs
and the parenthesized list of formal parameters. The statements that form the body of the function start at the next line, and must be indented. The first statement of the function body can optionally be a string literal; this string literal is the function's documentation string, or :dfn:`docstring`. (More about docst...
and the parenthesized list of formal parameters. The statements that form the body of the function start at the next line, and must be indented. The first statement of the function body can optionally be a string literal; this string literal is the function's documentation string, or :dfn:`docstring`. (More about docst...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7bee29d5-f4f9-43ba-b399-2a99e77acf3d
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,410
supabase-export-v2
5aea1f18dfdc6068
"guard". If the guard is false, ``match`` goes on to try the next case block. Note that value capture happens before the guard is evaluated:: match point: case Point(x, y) if x == y: print(f"Y=X at {x}") case Point(x, y): print(f"Not on the diagonal")
trusted_official_docs
CPython Docs
"guard". If the guard is false, ``match`` goes on to try the next case block. Note that value capture happens before the guard is evaluated:: match point: case Point(x, y) if x == y: print(f"Y=X at {x}") case Point(x, y): print(f"Not on the diagonal")
"guard". If the guard is false, ``match`` goes on to try the next case block. Note that value capture happens before the guard is evaluated:: match point: case Point(x, y) if x == y: print(f"Y=X at {x}") case Point(x, y): print(f"Not on the diagonal")
python, official-docs, cpython, P0
Local_Trusted_Corpus
7e4a6546-6307-4fb9-bc90-ceed5651463d
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,555
supabase-export-v2
1430adfd44714dfe
and the colon denoting the end of the :keyword:`def` statement. The following example has a required argument, an optional argument, and the return value annotated:: >>> def f(ham: str, eggs: str = 'eggs') -> str: ... print("Annotations:", f.__annotations__) ... print("Arguments:", ham, eggs) ... return ham + ' and ...
trusted_official_docs
CPython Docs
and the colon denoting the end of the :keyword:`def` statement. The following example has a required argument, an optional argument, and the return value annotated:: >>> def f(ham: str, eggs: str = 'eggs') -> str: ... print("Annotations:", f.__annotations__) ... print("Arguments:", ham, eggs) ... return ham + ' and ...
and the colon denoting the end of the :keyword:`def` statement. The following example has a required argument, an optional argument, and the return value annotated:: >>> def f(ham: str, eggs: str = 'eggs') -> str: ... print("Annotations:", f.__annotations__) ... print("Arguments:", ham, eggs) ... return ham + ' and ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7fbae635-7cb7-4c4a-9d3a-1a3676456b75
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,398
supabase-export-v2
16e9457a577c8e4b
Patterns can look like unpacking assignments, and can be used to bind variables:: # point is an (x, y) tuple match point: case (0, 0): print("Origin") case (0, y): print(f"Y={y}") case (x, 0): print(f"X={x}") case (x, y): print(f"X={x}, Y={y}") case _: raise ValueError("Not a point")
trusted_official_docs
CPython Docs
Patterns can look like unpacking assignments, and can be used to bind variables:: # point is an (x, y) tuple match point: case (0, 0): print("Origin") case (0, y): print(f"Y={y}") case (x, 0): print(f"X={x}") case (x, y): print(f"X={x}, Y={y}") case _: raise ValueError("Not a point")
Patterns can look like unpacking assignments, and can be used to bind variables:: # point is an (x, y) tuple match point: case (0, 0): print("Origin") case (0, y): print(f"Y={y}") case (x, 0): print(f"X={x}") case (x, y): print(f"X={x}, Y={y}") case _: raise ValueError("Not a point")
python, official-docs, cpython, P0
Local_Trusted_Corpus
8025b714-922d-4efb-a96e-0a1ad607a545
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,334
supabase-export-v2
90ea4409e5dcd0f5
to avoid excessive indentation. An :keyword:`!if` ... :keyword:`!elif` ... :keyword:`!elif` ... sequence is a substitute for the ``switch`` or ``case`` statements found in other languages. If you're comparing the same value to several constants, or checking for specific types or attributes, you may also find the :keywo...
trusted_official_docs
CPython Docs
to avoid excessive indentation. An :keyword:`!if` ... :keyword:`!elif` ... :keyword:`!elif` ... sequence is a substitute for the ``switch`` or ``case`` statements found in other languages. If you're comparing the same value to several constants, or checking for specific types or attributes, you may also find the :keywo...
to avoid excessive indentation. An :keyword:`!if` ... :keyword:`!elif` ... :keyword:`!elif` ... sequence is a substitute for the ``switch`` or ``case`` statements found in other languages. If you're comparing the same value to several constants, or checking for specific types or attributes, you may also find the :keywo...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8053bf16-4d5d-41a6-9f87-ce195775fbde
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,538
supabase-export-v2
2b513145ef8e1dd1
>>> def make_incrementor(n): ... return lambda x: x + n ... >>> f = make_incrementor(42) >>> f(0) 42 >>> f(1) 43 The above example uses a lambda expression to return a function. Another use is to pass a small function as an argument. For instance, :meth:`list.sort` takes a sorting key function *key* which can be a lamb...
trusted_official_docs
CPython Docs
>>> def make_incrementor(n): ... return lambda x: x + n ... >>> f = make_incrementor(42) >>> f(0) 42 >>> f(1) 43 The above example uses a lambda expression to return a function. Another use is to pass a small function as an argument. For instance, :meth:`list.sort` takes a sorting key function *key* which can be a lamb...
>>> def make_incrementor(n): ... return lambda x: x + n ... >>> f = make_incrementor(42) >>> f(0) 42 >>> f(1) 43 The above example uses a lambda expression to return a function. Another use is to pass a small function as an argument. For instance, :meth:`list.sort` takes a sorting key function *key* which can be a lamb...
python, official-docs, cpython, P0
Local_Trusted_Corpus
81234a8b-9266-4927-9368-2a7432538732
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,402
supabase-export-v2
b15216cf94ffdf8a
class Point: def __init__(self, x, y): self.x = x self.y = y def where_is(point): match point: case Point(x=0, y=0): print("Origin") case Point(x=0, y=y): print(f"Y={y}") case Point(x=x, y=0): print(f"X={x}") case Point(): print("Somewhere else") case _: print("Not a point")
trusted_official_docs
CPython Docs
class Point: def __init__(self, x, y): self.x = x self.y = y def where_is(point): match point: case Point(x=0, y=0): print("Origin") case Point(x=0, y=y): print(f"Y={y}") case Point(x=x, y=0): print(f"X={x}") case Point(): print("Somewhere else") case _: print("Not a point")
class Point: def __init__(self, x, y): self.x = x self.y = y def where_is(point): match point: case Point(x=0, y=0): print("Origin") case Point(x=0, y=y): print(f"Y={y}") case Point(x=x, y=0): print(f"X={x}") case Point(): print("Somewhere else") case _: print("Not a point")
python, official-docs, cpython, P0
Local_Trusted_Corpus
82a9b1e6-56aa-4b1e-8851-e9ac0fb07e0d
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,391
supabase-export-v2
fc220d408eade6fc
:keyword:`!match` Statements ============================ A :keyword:`match` statement takes an expression and compares its value to successive patterns given as one or more case blocks. This is superficially similar to a switch statement in C, Java or JavaScript (and many other languages), but it's more similar to pat...
trusted_official_docs
CPython Docs
:keyword:`!match` Statements ============================ A :keyword:`match` statement takes an expression and compares its value to successive patterns given as one or more case blocks. This is superficially similar to a switch statement in C, Java or JavaScript (and many other languages), but it's more similar to pat...
:keyword:`!match` Statements ============================ A :keyword:`match` statement takes an expression and compares its value to successive patterns given as one or more case blocks. This is superficially similar to a switch statement in C, Java or JavaScript (and many other languages), but it's more similar to pat...
python, official-docs, cpython, P0
Local_Trusted_Corpus
82fd8044-3814-4bb1-9b0c-b7ba357e603d
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,400
supabase-export-v2
3b9e63fea4d85808
a value from the subject (``point``). The fourth pattern captures two values, which makes it conceptually similar to the unpacking assignment ``(x, y) = point``. If you are using classes to structure your data you can use the class name followed by an argument list resembling a constructor, but with the ability to capt...
trusted_official_docs
CPython Docs
a value from the subject (``point``). The fourth pattern captures two values, which makes it conceptually similar to the unpacking assignment ``(x, y) = point``. If you are using classes to structure your data you can use the class name followed by an argument list resembling a constructor, but with the ability to capt...
a value from the subject (``point``). The fourth pattern captures two values, which makes it conceptually similar to the unpacking assignment ``(x, y) = point``. If you are using classes to structure your data you can use the class name followed by an argument list resembling a constructor, but with the ability to capt...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8961f124-d86e-4fea-830c-a4f0e8191488
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,394
supabase-export-v2
549b5b6cac8f9330
status: case 400: return "Bad request" case 404: return "Not found" case 418: return "I'm a teapot" case _: return "Something's wrong with the internet" Note the last block: the "variable name" ``_`` acts as a *wildcard* and never fails to match.
trusted_official_docs
CPython Docs
status: case 400: return "Bad request" case 404: return "Not found" case 418: return "I'm a teapot" case _: return "Something's wrong with the internet" Note the last block: the "variable name" ``_`` acts as a *wildcard* and never fails to match.
status: case 400: return "Bad request" case 404: return "Not found" case 418: return "I'm a teapot" case _: return "Something's wrong with the internet" Note the last block: the "variable name" ``_`` acts as a *wildcard* and never fails to match.
python, official-docs, cpython, P0
Local_Trusted_Corpus
8a5ec09b-3ccd-4608-9669-0598648e4787
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,423
supabase-export-v2
188d43b8a4025dcd
match color: case Color.RED: print("I see red!") case Color.GREEN: print("Grass is green") case Color.BLUE: print("I'm feeling the blues :(") For a more detailed explanation and additional examples, you can look into :pep:`636` which is written in a tutorial format.
trusted_official_docs
CPython Docs
match color: case Color.RED: print("I see red!") case Color.GREEN: print("Grass is green") case Color.BLUE: print("I'm feeling the blues :(") For a more detailed explanation and additional examples, you can look into :pep:`636` which is written in a tutorial format.
match color: case Color.RED: print("I see red!") case Color.GREEN: print("Grass is green") case Color.BLUE: print("I'm feeling the blues :(") For a more detailed explanation and additional examples, you can look into :pep:`636` which is written in a tutorial format.
python, official-docs, cpython, P0
Local_Trusted_Corpus
8aa6e288-9052-453e-aa99-fecbf2e6eca5
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,479
supabase-export-v2
dc4e5e45452d4107
Special parameters ------------------ By default, arguments may be passed to a Python function either by position or explicitly by keyword. For readability and performance, it makes sense to restrict the way arguments can be passed so that a developer need only look at the function definition to determine if items are ...
trusted_official_docs
CPython Docs
Special parameters ------------------ By default, arguments may be passed to a Python function either by position or explicitly by keyword. For readability and performance, it makes sense to restrict the way arguments can be passed so that a developer need only look at the function definition to determine if items are ...
Special parameters ------------------ By default, arguments may be passed to a Python function either by position or explicitly by keyword. For readability and performance, it makes sense to restrict the way arguments can be passed so that a developer need only look at the function definition to determine if items are ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8b360f20-e80c-4645-ab17-3c6190652c54
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,507
supabase-export-v2
32b879efbca2fd99
>>> combined_example(1, standard=2, kwd_only=3) 1 2 3 >>> combined_example(pos_only=1, standard=2, kwd_only=3) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: combined_example() got some positional-only arguments passed as keyword arguments: 'pos_only'
trusted_official_docs
CPython Docs
>>> combined_example(1, standard=2, kwd_only=3) 1 2 3 >>> combined_example(pos_only=1, standard=2, kwd_only=3) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: combined_example() got some positional-only arguments passed as keyword arguments: 'pos_only'
>>> combined_example(1, standard=2, kwd_only=3) 1 2 3 >>> combined_example(pos_only=1, standard=2, kwd_only=3) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: combined_example() got some positional-only arguments passed as keyword arguments: 'pos_only'
python, official-docs, cpython, P0
Local_Trusted_Corpus
8b7e0409-0f60-451e-863b-e5fff1b23f5c
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,493
supabase-export-v2
0adf7bc60d47bcb4
Consider the following example function definitions paying close attention to the markers ``/`` and ``*``:: >>> def standard_arg(arg): ... print(arg) ... >>> def pos_only_arg(arg, /): ... print(arg) ... >>> def kwd_only_arg(*, arg): ... print(arg) ... >>> def combined_example(pos_only, /, standard, *, kwd_only): ...
trusted_official_docs
CPython Docs
Consider the following example function definitions paying close attention to the markers ``/`` and ``*``:: >>> def standard_arg(arg): ... print(arg) ... >>> def pos_only_arg(arg, /): ... print(arg) ... >>> def kwd_only_arg(*, arg): ... print(arg) ... >>> def combined_example(pos_only, /, standard, *, kwd_only): ...
Consider the following example function definitions paying close attention to the markers ``/`` and ``*``:: >>> def standard_arg(arg): ... print(arg) ... >>> def pos_only_arg(arg, /): ... print(arg) ... >>> def kwd_only_arg(*, arg): ... print(arg) ... >>> def combined_example(pos_only, /, standard, *, kwd_only): ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8c6e4384-f097-4074-9c96-3c02955811bf
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,563
supabase-export-v2
0746dbcd7f9e221c
are a good compromise between small indentation (allows greater nesting depth) and large indentation (easier to read). Tabs introduce confusion, and are best left out. * Wrap lines so that they don't exceed 79 characters.
trusted_official_docs
CPython Docs
are a good compromise between small indentation (allows greater nesting depth) and large indentation (easier to read). Tabs introduce confusion, and are best left out. * Wrap lines so that they don't exceed 79 characters.
are a good compromise between small indentation (allows greater nesting depth) and large indentation (easier to read). Tabs introduce confusion, and are best left out. * Wrap lines so that they don't exceed 79 characters.
python, official-docs, cpython, P0
Local_Trusted_Corpus
8fc70ca7-9651-4935-b01b-6dd9b21442d7
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,455
supabase-export-v2
893b2fa32322fa48
object such as a list, dictionary, or instances of most classes. For example, the following function accumulates the arguments passed to it on subsequent calls:: def f(a, L=[]): L.append(a) return L
trusted_official_docs
CPython Docs
object such as a list, dictionary, or instances of most classes. For example, the following function accumulates the arguments passed to it on subsequent calls:: def f(a, L=[]): L.append(a) return L
object such as a list, dictionary, or instances of most classes. For example, the following function accumulates the arguments passed to it on subsequent calls:: def f(a, L=[]): L.append(a) return L
python, official-docs, cpython, P0
Local_Trusted_Corpus
8fe478e7-1b2f-4b22-a07b-198a037d16e6
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,464
supabase-export-v2
a7dd5a3fee9de5da
type='Norwegian Blue'): print("-- This parrot wouldn't", action, end=' ') print("if you put", voltage, "volts through it.") print("-- Lovely plumage, the", type) print("-- It's", state, "!") accepts one required argument (``voltage``) and three optional arguments (``state``, ``action``, and ``type``). This function can...
trusted_official_docs
CPython Docs
type='Norwegian Blue'): print("-- This parrot wouldn't", action, end=' ') print("if you put", voltage, "volts through it.") print("-- Lovely plumage, the", type) print("-- It's", state, "!") accepts one required argument (``voltage``) and three optional arguments (``state``, ``action``, and ``type``). This function can...
type='Norwegian Blue'): print("-- This parrot wouldn't", action, end=' ') print("if you put", voltage, "volts through it.") print("-- Lovely plumage, the", type) print("-- It's", state, "!") accepts one required argument (``voltage``) and three optional arguments (``state``, ``action``, and ``type``). This function can...
python, official-docs, cpython, P0
Local_Trusted_Corpus
90ef4d3d-7d75-4221-82a2-fc5e80553cd0
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,408
supabase-export-v2
5c1fbfca39f6e890
class Point: __match_args__ = ('x', 'y') def __init__(self, x, y): self.x = x self.y = y match points: case []: print("No points") case [Point(0, 0)]: print("The origin") case [Point(x, y)]: print(f"Single point {x}, {y}") case [Point(0, y1), Point(0, y2)]: print(f"Two on the Y axis at {y1}, {y2}") case _: pr...
trusted_official_docs
CPython Docs
class Point: __match_args__ = ('x', 'y') def __init__(self, x, y): self.x = x self.y = y match points: case []: print("No points") case [Point(0, 0)]: print("The origin") case [Point(x, y)]: print(f"Single point {x}, {y}") case [Point(0, y1), Point(0, y2)]: print(f"Two on the Y axis at {y1}, {y2}") case _: pr...
class Point: __match_args__ = ('x', 'y') def __init__(self, x, y): self.x = x self.y = y match points: case []: print("No points") case [Point(0, 0)]: print("The origin") case [Point(x, y)]: print(f"Single point {x}, {y}") case [Point(0, y1), Point(0, y2)]: print(f"Two on the Y axis at {y1}, {y2}") case _: pr...
python, official-docs, cpython, P0
Local_Trusted_Corpus
914e5b69-c6c7-4076-93fa-ac915bb0b55d
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,529
supabase-export-v2
78521edd33808849
Unpacking Argument Lists ------------------------ The reverse situation occurs when the arguments are already in a list or tuple but need to be unpacked for a function call requiring separate positional arguments. For instance, the built-in :func:`range` function expects separate *start* and *stop* arguments. If they a...
trusted_official_docs
CPython Docs
Unpacking Argument Lists ------------------------ The reverse situation occurs when the arguments are already in a list or tuple but need to be unpacked for a function call requiring separate positional arguments. For instance, the built-in :func:`range` function expects separate *start* and *stop* arguments. If they a...
Unpacking Argument Lists ------------------------ The reverse situation occurs when the arguments are already in a list or tuple but need to be unpacked for a function call requiring separate positional arguments. For instance, the built-in :func:`range` function expects separate *start* and *stop* arguments. If they a...
python, official-docs, cpython, P0
Local_Trusted_Corpus
93c1e63a-d78a-4418-864a-60aece55e18b
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,433
supabase-export-v2
8d166b1c2aa8af5b
value of the object). [#]_ When a function calls another function, or calls itself recursively, a new local symbol table is created for that call. A function definition associates the function name with the function object in the current symbol table. The interpreter recognizes the object pointed to by that name as a u...
trusted_official_docs
CPython Docs
value of the object). [#]_ When a function calls another function, or calls itself recursively, a new local symbol table is created for that call. A function definition associates the function name with the function object in the current symbol table. The interpreter recognizes the object pointed to by that name as a u...
value of the object). [#]_ When a function calls another function, or calls itself recursively, a new local symbol table is created for that call. A function definition associates the function name with the function object in the current symbol table. The interpreter recognizes the object pointed to by that name as a u...
python, official-docs, cpython, P0
Local_Trusted_Corpus
94d47d10-9c2e-45fd-8485-b887fb0bf5e0
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,418
supabase-export-v2
eb4e46f321c6db0a
will capture the second element of the input as ``p2`` (as long as the input is a sequence of two points) - Most literals are compared by equality, however the singletons ``True``, ``False`` and ``None`` are compared by identity.
trusted_official_docs
CPython Docs
will capture the second element of the input as ``p2`` (as long as the input is a sequence of two points) - Most literals are compared by equality, however the singletons ``True``, ``False`` and ``None`` are compared by identity.
will capture the second element of the input as ``p2`` (as long as the input is a sequence of two points) - Most literals are compared by equality, however the singletons ``True``, ``False`` and ``None`` are compared by identity.
python, official-docs, cpython, P0
Local_Trusted_Corpus
94fe1b98-d7fd-4a23-af16-e146906aeac5
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,436
supabase-export-v2
f4d973408985f992
is normally suppressed by the interpreter if it would be the only value written. You can see it if you really want to using :func:`print`:: >>> fib(0) >>> print(fib(0)) None
trusted_official_docs
CPython Docs
is normally suppressed by the interpreter if it would be the only value written. You can see it if you really want to using :func:`print`:: >>> fib(0) >>> print(fib(0)) None
is normally suppressed by the interpreter if it would be the only value written. You can see it if you really want to using :func:`print`:: >>> fib(0) >>> print(fib(0)) None
python, official-docs, cpython, P0
Local_Trusted_Corpus
98853c5f-46de-4e8e-9fbc-6fe79543f0c6
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,476
supabase-export-v2
06c58111e0cd134b
.. code-block:: none -- Do you have any Limburger ? -- I'm sorry, we're all out of Limburger It's very runny, sir. It's really very, VERY runny, sir. ---------------------------------------- shopkeeper : Michael Palin client : John Cleese sketch : Cheese Shop Sketch
trusted_official_docs
CPython Docs
.. code-block:: none -- Do you have any Limburger ? -- I'm sorry, we're all out of Limburger It's very runny, sir. It's really very, VERY runny, sir. ---------------------------------------- shopkeeper : Michael Palin client : John Cleese sketch : Cheese Shop Sketch
.. code-block:: none -- Do you have any Limburger ? -- I'm sorry, we're all out of Limburger It's very runny, sir. It's really very, VERY runny, sir. ---------------------------------------- shopkeeper : Michael Palin client : John Cleese sketch : Cheese Shop Sketch
python, official-docs, cpython, P0
Local_Trusted_Corpus
98cacef9-007e-4950-ae56-34c65fa946d6
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,409
supabase-export-v2
23af08fa1156cf16
origin") case [Point(x, y)]: print(f"Single point {x}, {y}") case [Point(0, y1), Point(0, y2)]: print(f"Two on the Y axis at {y1}, {y2}") case _: print("Something else") We can add an ``if`` clause to a pattern, known as a "guard". If the guard is false, ``match`` goes on to try the next case block. Note that value cap...
trusted_official_docs
CPython Docs
origin") case [Point(x, y)]: print(f"Single point {x}, {y}") case [Point(0, y1), Point(0, y2)]: print(f"Two on the Y axis at {y1}, {y2}") case _: print("Something else") We can add an ``if`` clause to a pattern, known as a "guard". If the guard is false, ``match`` goes on to try the next case block. Note that value cap...
origin") case [Point(x, y)]: print(f"Single point {x}, {y}") case [Point(0, y1), Point(0, y2)]: print(f"Two on the Y axis at {y1}, {y2}") case _: print("Something else") We can add an ``if`` clause to a pattern, known as a "guard". If the guard is false, ``match`` goes on to try the next case block. Note that value cap...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9959532f-ec43-47e3-80a8-d018b34c09ab
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,488
supabase-export-v2
b270dee99514cd15
logically separate the positional-only parameters from the rest of the parameters. If there is no ``/`` in the function definition, there are no positional-only parameters. Parameters following the ``/`` may be *positional-or-keyword* or *keyword-only*.
trusted_official_docs
CPython Docs
logically separate the positional-only parameters from the rest of the parameters. If there is no ``/`` in the function definition, there are no positional-only parameters. Parameters following the ``/`` may be *positional-or-keyword* or *keyword-only*.
logically separate the positional-only parameters from the rest of the parameters. If there is no ``/`` in the function definition, there are no positional-only parameters. Parameters following the ``/`` may be *positional-or-keyword* or *keyword-only*.
python, official-docs, cpython, P0
Local_Trusted_Corpus
9af5680f-3070-4a5a-bd1b-6a21450261ec
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,569
supabase-export-v2
a7f5e3982c959777
* Use spaces around operators and after commas, but not directly inside bracketing constructs: ``a = f(1, 2) + g(3, 4)``. * Name your classes and functions consistently; the convention is to use ``UpperCamelCase`` for classes and ``lowercase_with_underscores`` for functions and methods. Always use ``self`` as the nam...
trusted_official_docs
CPython Docs
* Use spaces around operators and after commas, but not directly inside bracketing constructs: ``a = f(1, 2) + g(3, 4)``. * Name your classes and functions consistently; the convention is to use ``UpperCamelCase`` for classes and ``lowercase_with_underscores`` for functions and methods. Always use ``self`` as the nam...
* Use spaces around operators and after commas, but not directly inside bracketing constructs: ``a = f(1, 2) + g(3, 4)``. * Name your classes and functions consistently; the convention is to use ``UpperCamelCase`` for classes and ``lowercase_with_underscores`` for functions and methods. Always use ``self`` as the nam...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9d48bcdb-fcd3-4c92-976e-f29730c0fe66
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,372
supabase-export-v2
611c31cee47bdd3f
or :keyword:`!while` loop the :keyword:`!break` statement may be paired with an :keyword:`!else` clause. If the loop finishes without executing the :keyword:`!break`, the :keyword:`!else` clause executes. In a :keyword:`for` loop, the :keyword:`!else` clause is executed after the loop finishes its final iteration, that...
trusted_official_docs
CPython Docs
or :keyword:`!while` loop the :keyword:`!break` statement may be paired with an :keyword:`!else` clause. If the loop finishes without executing the :keyword:`!break`, the :keyword:`!else` clause executes. In a :keyword:`for` loop, the :keyword:`!else` clause is executed after the loop finishes its final iteration, that...
or :keyword:`!while` loop the :keyword:`!break` statement may be paired with an :keyword:`!else` clause. If the loop finishes without executing the :keyword:`!break`, the :keyword:`!else` clause executes. In a :keyword:`for` loop, the :keyword:`!else` clause is executed after the loop finishes its final iteration, that...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9d98e5ee-1ac3-4740-ada0-8b095c4ce0b4
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,356
supabase-export-v2
e80702bd110867e5
= ['Mary', 'had', 'a', 'little', 'lamb'] >>> for i in range(len(a)): ... print(i, a[i]) ... 0 Mary 1 had 2 a 3 little 4 lamb In most such cases, however, it is convenient to use the :func:`enumerate` function, see :ref:`tut-loopidioms`.
trusted_official_docs
CPython Docs
= ['Mary', 'had', 'a', 'little', 'lamb'] >>> for i in range(len(a)): ... print(i, a[i]) ... 0 Mary 1 had 2 a 3 little 4 lamb In most such cases, however, it is convenient to use the :func:`enumerate` function, see :ref:`tut-loopidioms`.
= ['Mary', 'had', 'a', 'little', 'lamb'] >>> for i in range(len(a)): ... print(i, a[i]) ... 0 Mary 1 had 2 a 3 little 4 lamb In most such cases, however, it is convenient to use the :func:`enumerate` function, see :ref:`tut-loopidioms`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
a023bce4-7a5f-467e-8160-07ce0a07d0f9
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,560
supabase-export-v2
0ea0fadb392a0791
others. Making it easy for others to read your code is always a good idea, and adopting a nice coding style helps tremendously for that. For Python, :pep:`8` has emerged as the style guide that most projects adhere to; it promotes a very readable and eye-pleasing coding style. Every Python developer should read it at s...
trusted_official_docs
CPython Docs
others. Making it easy for others to read your code is always a good idea, and adopting a nice coding style helps tremendously for that. For Python, :pep:`8` has emerged as the style guide that most projects adhere to; it promotes a very readable and eye-pleasing coding style. Every Python developer should read it at s...
others. Making it easy for others to read your code is always a good idea, and adopting a nice coding style helps tremendously for that. For Python, :pep:`8` has emerged as the style guide that most projects adhere to; it promotes a very readable and eye-pleasing coding style. Every Python developer should read it at s...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a16021d3-d969-498c-bcff-72f37dff68d5
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,570
supabase-export-v2
4550320e497360ed
and ``lowercase_with_underscores`` for functions and methods. Always use ``self`` as the name for the first method argument (see :ref:`tut-firstclasses` for more on classes and methods). * Don't use fancy encodings if your code is meant to be used in international environments. Python's default, UTF-8, or even plain A...
trusted_official_docs
CPython Docs
and ``lowercase_with_underscores`` for functions and methods. Always use ``self`` as the name for the first method argument (see :ref:`tut-firstclasses` for more on classes and methods). * Don't use fancy encodings if your code is meant to be used in international environments. Python's default, UTF-8, or even plain A...
and ``lowercase_with_underscores`` for functions and methods. Always use ``self`` as the name for the first method argument (see :ref:`tut-firstclasses` for more on classes and methods). * Don't use fancy encodings if your code is meant to be used in international environments. Python's default, UTF-8, or even plain A...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a25ed4a5-d97b-41fb-b002-ecb7e50c7a78
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,350
supabase-export-v2
cfdc831993ba896a
>>> for i in range(5): ... print(i) ... 0 1 2 3 4 The given end point is never part of the generated sequence; ``range(10)`` generates 10 values, the legal indices for items of a sequence of length 10. It is possible to let the range start at another number, or to specify a different increment (even negative; sometimes...
trusted_official_docs
CPython Docs
>>> for i in range(5): ... print(i) ... 0 1 2 3 4 The given end point is never part of the generated sequence; ``range(10)`` generates 10 values, the legal indices for items of a sequence of length 10. It is possible to let the range start at another number, or to specify a different increment (even negative; sometimes...
>>> for i in range(5): ... print(i) ... 0 1 2 3 4 The given end point is never part of the generated sequence; ``range(10)`` generates 10 values, the legal indices for items of a sequence of length 10. It is possible to let the range start at another number, or to specify a different increment (even negative; sometimes...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a70b88d6-55bc-4ac9-9e23-8df19c8108a8
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,355
supabase-export-v2
308cd0b49d6acd3d
To iterate over the indices of a sequence, you can combine :func:`range` and :func:`len` as follows:: >>> a = ['Mary', 'had', 'a', 'little', 'lamb'] >>> for i in range(len(a)): ... print(i, a[i]) ... 0 Mary 1 had 2 a 3 little 4 lamb
trusted_official_docs
CPython Docs
To iterate over the indices of a sequence, you can combine :func:`range` and :func:`len` as follows:: >>> a = ['Mary', 'had', 'a', 'little', 'lamb'] >>> for i in range(len(a)): ... print(i, a[i]) ... 0 Mary 1 had 2 a 3 little 4 lamb
To iterate over the indices of a sequence, you can combine :func:`range` and :func:`len` as follows:: >>> a = ['Mary', 'had', 'a', 'little', 'lamb'] >>> for i in range(len(a)): ... print(i, a[i]) ... 0 Mary 1 had 2 a 3 little 4 lamb
python, official-docs, cpython, P0
Local_Trusted_Corpus
a7f11110-95d3-48b1-b2ed-2aac4487a969
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,465
supabase-export-v2
0332b01d580e8164
accepts one required argument (``voltage``) and three optional arguments (``state``, ``action``, and ``type``). This function can be called in any of the following ways:: parrot(1000) # 1 positional argument parrot(voltage=1000) # 1 keyword argument parrot(voltage=1000000, action='VOOOOOM') # 2 keyword arguments par...
trusted_official_docs
CPython Docs
accepts one required argument (``voltage``) and three optional arguments (``state``, ``action``, and ``type``). This function can be called in any of the following ways:: parrot(1000) # 1 positional argument parrot(voltage=1000) # 1 keyword argument parrot(voltage=1000000, action='VOOOOOM') # 2 keyword arguments par...
accepts one required argument (``voltage``) and three optional arguments (``state``, ``action``, and ``type``). This function can be called in any of the following ways:: parrot(1000) # 1 positional argument parrot(voltage=1000) # 1 keyword argument parrot(voltage=1000000, action='VOOOOOM') # 2 keyword arguments par...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b4adf93b-6113-44fd-b55e-09848d62862b
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,339
supabase-export-v2
2b5e07c2fe230fb8
over the items of any sequence (a list or a string), in the order that they appear in the sequence. For example (no pun intended): .. One suggestion was to give a real C example here, but that may only serve to confuse non-C programmers.
trusted_official_docs
CPython Docs
over the items of any sequence (a list or a string), in the order that they appear in the sequence. For example (no pun intended): .. One suggestion was to give a real C example here, but that may only serve to confuse non-C programmers.
over the items of any sequence (a list or a string), in the order that they appear in the sequence. For example (no pun intended): .. One suggestion was to give a real C example here, but that may only serve to confuse non-C programmers.
python, official-docs, cpython, P0
Local_Trusted_Corpus
b58b56e0-ad09-479b-92fb-6d99e7bce64a
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,380
supabase-export-v2
df5836fae9d5b891
runs when no exception occurs, and a loop's ``else`` clause runs when no ``break`` occurs. For more on the ``try`` statement and exceptions, see :ref:`tut-handling`. .. index:: single: ...; ellipsis literal .. _tut-pass:
trusted_official_docs
CPython Docs
runs when no exception occurs, and a loop's ``else`` clause runs when no ``break`` occurs. For more on the ``try`` statement and exceptions, see :ref:`tut-handling`. .. index:: single: ...; ellipsis literal .. _tut-pass:
runs when no exception occurs, and a loop's ``else`` clause runs when no ``break`` occurs. For more on the ``try`` statement and exceptions, see :ref:`tut-handling`. .. index:: single: ...; ellipsis literal .. _tut-pass:
python, official-docs, cpython, P0
Local_Trusted_Corpus
b6afb68b-f3f1-4622-a900-3382f9deda27
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,559
supabase-export-v2
219cb3a478714f24
.. index:: pair: coding; style Now that you are about to write longer, more complex pieces of Python, it is a good time to talk about *coding style*. Most languages can be written (or more concisely, *formatted*) in different styles; some are more readable than others. Making it easy for others to read your code is alw...
trusted_official_docs
CPython Docs
.. index:: pair: coding; style Now that you are about to write longer, more complex pieces of Python, it is a good time to talk about *coding style*. Most languages can be written (or more concisely, *formatted*) in different styles; some are more readable than others. Making it easy for others to read your code is alw...
.. index:: pair: coding; style Now that you are about to write longer, more complex pieces of Python, it is a good time to talk about *coding style*. Most languages can be written (or more concisely, *formatted*) in different styles; some are more readable than others. Making it easy for others to read your code is alw...
python, official-docs, cpython, P0
Local_Trusted_Corpus
baea1eb5-681c-42d1-b076-188c1c244117
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,383
supabase-export-v2
8f1dce318547f460
The :keyword:`pass` statement does nothing. It can be used when a statement is required syntactically but the program requires no action. For example:: >>> while True: ... pass # Busy-wait for keyboard interrupt (Ctrl+C) ...
trusted_official_docs
CPython Docs
The :keyword:`pass` statement does nothing. It can be used when a statement is required syntactically but the program requires no action. For example:: >>> while True: ... pass # Busy-wait for keyboard interrupt (Ctrl+C) ...
The :keyword:`pass` statement does nothing. It can be used when a statement is required syntactically but the program requires no action. For example:: >>> while True: ... pass # Busy-wait for keyboard interrupt (Ctrl+C) ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
bb0e9b8e-985e-4250-af26-2d81f2a37ab7
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,362
supabase-export-v2
c09ecb3517230080
>>> sum(range(4)) # 0 + 1 + 2 + 3 6 Later we will see more functions that return iterables and take iterables as arguments. In chapter :ref:`tut-structures`, we will discuss :func:`list` in more detail.
trusted_official_docs
CPython Docs
>>> sum(range(4)) # 0 + 1 + 2 + 3 6 Later we will see more functions that return iterables and take iterables as arguments. In chapter :ref:`tut-structures`, we will discuss :func:`list` in more detail.
>>> sum(range(4)) # 0 + 1 + 2 + 3 6 Later we will see more functions that return iterables and take iterables as arguments. In chapter :ref:`tut-structures`, we will discuss :func:`list` in more detail.
python, official-docs, cpython, P0
Local_Trusted_Corpus
bb2a3f75-300c-42db-a848-a12e7b77267a
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,448
supabase-export-v2
9db7d7cfb1bda99c
value for one or more arguments. This creates a function that can be called with fewer arguments than it is defined to allow. For example:: def ask_ok(prompt, retries=4, reminder='Please try again!'): while True: reply = input(prompt) if reply in {'y', 'ye', 'yes'}: return True if reply in {'n', 'no', 'nop', 'nope...
trusted_official_docs
CPython Docs
value for one or more arguments. This creates a function that can be called with fewer arguments than it is defined to allow. For example:: def ask_ok(prompt, retries=4, reminder='Please try again!'): while True: reply = input(prompt) if reply in {'y', 'ye', 'yes'}: return True if reply in {'n', 'no', 'nop', 'nope...
value for one or more arguments. This creates a function that can be called with fewer arguments than it is defined to allow. For example:: def ask_ok(prompt, retries=4, reminder='Please try again!'): while True: reply = input(prompt) if reply in {'y', 'ye', 'yes'}: return True if reply in {'n', 'no', 'nop', 'nope...
python, official-docs, cpython, P0
Local_Trusted_Corpus
bb3fbbcf-a1c4-4b41-9613-d8e8d4730a63
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,333
supabase-export-v2
dcf59f0cc3706e53
... print('Negative changed to zero') ... elif x == 0: ... print('Zero') ... elif x == 1: ... print('Single') ... else: ... print('More') ... More There can be zero or more :keyword:`elif` parts, and the :keyword:`else` part is optional. The keyword ':keyword:`!elif`' is short for 'else if', and is useful to avoid exce...
trusted_official_docs
CPython Docs
... print('Negative changed to zero') ... elif x == 0: ... print('Zero') ... elif x == 1: ... print('Single') ... else: ... print('More') ... More There can be zero or more :keyword:`elif` parts, and the :keyword:`else` part is optional. The keyword ':keyword:`!elif`' is short for 'else if', and is useful to avoid exce...
... print('Negative changed to zero') ... elif x == 0: ... print('Zero') ... elif x == 1: ... print('Single') ... else: ... print('More') ... More There can be zero or more :keyword:`elif` parts, and the :keyword:`else` part is optional. The keyword ':keyword:`!elif`' is short for 'else if', and is useful to avoid exce...
python, official-docs, cpython, P0
Local_Trusted_Corpus
bb5702a7-f2ee-4ddf-9aff-0f9442027822
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,466
supabase-export-v2
79142a929b438bc6
# 2 keyword arguments parrot('a million', 'bereft of life', 'jump') # 3 positional arguments parrot('a thousand', state='pushing up the daisies') # 1 positional, 1 keyword but all the following calls would be invalid::
trusted_official_docs
CPython Docs
# 2 keyword arguments parrot('a million', 'bereft of life', 'jump') # 3 positional arguments parrot('a thousand', state='pushing up the daisies') # 1 positional, 1 keyword but all the following calls would be invalid::
# 2 keyword arguments parrot('a million', 'bereft of life', 'jump') # 3 positional arguments parrot('a thousand', state='pushing up the daisies') # 1 positional, 1 keyword but all the following calls would be invalid::
python, official-docs, cpython, P0
Local_Trusted_Corpus
bca9f14b-1fa6-42aa-bfc3-ef320a4b249d
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,514
supabase-export-v2
36ac6339b04016c1
>>> def foo(name, /, **kwds): ... return 'name' in kwds ... >>> foo(1, **{'name': 2}) True In other words, the names of positional-only parameters can be used in ``**kwds`` without ambiguity.
trusted_official_docs
CPython Docs
>>> def foo(name, /, **kwds): ... return 'name' in kwds ... >>> foo(1, **{'name': 2}) True In other words, the names of positional-only parameters can be used in ``**kwds`` without ambiguity.
>>> def foo(name, /, **kwds): ... return 'name' in kwds ... >>> foo(1, **{'name': 2}) True In other words, the names of positional-only parameters can be used in ``**kwds`` without ambiguity.
python, official-docs, cpython, P0
Local_Trusted_Corpus
bd5a0edf-ace8-4b01-a9d9-b085b7a62af3
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,505
supabase-export-v2
4bc949efee1c0d71
>>> combined_example(1, 2, 3) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: combined_example() takes 2 positional arguments but 3 were given >>> combined_example(1, 2, kwd_only=3) 1 2 3
trusted_official_docs
CPython Docs
>>> combined_example(1, 2, 3) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: combined_example() takes 2 positional arguments but 3 were given >>> combined_example(1, 2, kwd_only=3) 1 2 3
>>> combined_example(1, 2, 3) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: combined_example() takes 2 positional arguments but 3 were given >>> combined_example(1, 2, kwd_only=3) 1 2 3
python, official-docs, cpython, P0
Local_Trusted_Corpus
beffe624-c090-46fa-9c91-97bd631bae0d
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,562
supabase-export-v2
43c10899ee3dc629
* Use 4-space indentation, and no tabs. 4 spaces are a good compromise between small indentation (allows greater nesting depth) and large indentation (easier to read). Tabs introduce confusion, and are best left out.
trusted_official_docs
CPython Docs
* Use 4-space indentation, and no tabs. 4 spaces are a good compromise between small indentation (allows greater nesting depth) and large indentation (easier to read). Tabs introduce confusion, and are best left out.
* Use 4-space indentation, and no tabs. 4 spaces are a good compromise between small indentation (allows greater nesting depth) and large indentation (easier to read). Tabs introduce confusion, and are best left out.
python, official-docs, cpython, P0
Local_Trusted_Corpus
c14cf0ef-2326-448c-9f9b-d4c98f2cc7c1
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,500
supabase-export-v2
b824ae47633f338b
>>> pos_only_arg(arg=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: pos_only_arg() got some positional-only arguments passed as keyword arguments: 'arg' The third function ``kwd_only_arg`` only allows keyword arguments as indicated by a ``*`` in the function definition::
trusted_official_docs
CPython Docs
>>> pos_only_arg(arg=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: pos_only_arg() got some positional-only arguments passed as keyword arguments: 'arg' The third function ``kwd_only_arg`` only allows keyword arguments as indicated by a ``*`` in the function definition::
>>> pos_only_arg(arg=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: pos_only_arg() got some positional-only arguments passed as keyword arguments: 'arg' The third function ``kwd_only_arg`` only allows keyword arguments as indicated by a ``*`` in the function definition::
python, official-docs, cpython, P0
Local_Trusted_Corpus
c43484ac-15f2-4a7d-9556-c3554c45c6b3
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,450
supabase-export-v2
eef6c9d25cf83474
This function can be called in several ways: * giving only the mandatory argument: ``ask_ok('Do you really want to quit?')`` * giving one of the optional arguments: ``ask_ok('OK to overwrite the file?', 2)`` * or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or no!')``
trusted_official_docs
CPython Docs
This function can be called in several ways: * giving only the mandatory argument: ``ask_ok('Do you really want to quit?')`` * giving one of the optional arguments: ``ask_ok('OK to overwrite the file?', 2)`` * or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or no!')``
This function can be called in several ways: * giving only the mandatory argument: ``ask_ok('Do you really want to quit?')`` * giving one of the optional arguments: ``ask_ok('OK to overwrite the file?', 2)`` * or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or no!')``
python, official-docs, cpython, P0
Local_Trusted_Corpus
c8f739ec-fda7-440b-93f1-a1ec9a53daf1
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,441
supabase-export-v2
9981bbd0985682ec
statement returns with a value from a function. :keyword:`!return` without an expression argument returns ``None``. Falling off the end of a function also returns ``None``. * The statement ``result.append(a)`` calls a *method* of the list object ``result``. A method is a function that 'belongs' to an object and is nam...
trusted_official_docs
CPython Docs
statement returns with a value from a function. :keyword:`!return` without an expression argument returns ``None``. Falling off the end of a function also returns ``None``. * The statement ``result.append(a)`` calls a *method* of the list object ``result``. A method is a function that 'belongs' to an object and is nam...
statement returns with a value from a function. :keyword:`!return` without an expression argument returns ``None``. Falling off the end of a function also returns ``None``. * The statement ``result.append(a)`` calls a *method* of the list object ``result``. A method is a function that 'belongs' to an object and is nam...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c94327f6-205e-41d5-85ae-a062900cb7f1
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,377
supabase-export-v2
680b4e7261c3c8c9
5 is a prime number 6 equals 2 * 3 7 is a prime number 8 equals 2 * 4 9 equals 3 * 3 (Yes, this is the correct code. Look closely: the ``else`` clause belongs to the ``for`` loop, **not** the ``if`` statement.)
trusted_official_docs
CPython Docs
5 is a prime number 6 equals 2 * 3 7 is a prime number 8 equals 2 * 4 9 equals 3 * 3 (Yes, this is the correct code. Look closely: the ``else`` clause belongs to the ``for`` loop, **not** the ``if`` statement.)
5 is a prime number 6 equals 2 * 3 7 is a prime number 8 equals 2 * 4 9 equals 3 * 3 (Yes, this is the correct code. Look closely: the ``else`` clause belongs to the ``for`` loop, **not** the ``if`` statement.)
python, official-docs, cpython, P0
Local_Trusted_Corpus
cb3fc4d8-0595-440b-8349-3222872a48e0
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,404
supabase-export-v2
a7574fd22169ac5d
in your classes. If it's set to ("x", "y"), the following patterns are all equivalent (and all bind the ``y`` attribute to the ``var`` variable):: Point(1, var) Point(1, y=var) Point(x=1, y=var) Point(y=var, x=1)
trusted_official_docs
CPython Docs
in your classes. If it's set to ("x", "y"), the following patterns are all equivalent (and all bind the ``y`` attribute to the ``var`` variable):: Point(1, var) Point(1, y=var) Point(x=1, y=var) Point(y=var, x=1)
in your classes. If it's set to ("x", "y"), the following patterns are all equivalent (and all bind the ``y`` attribute to the ``var`` variable):: Point(1, var) Point(1, y=var) Point(x=1, y=var) Point(y=var, x=1)
python, official-docs, cpython, P0
Local_Trusted_Corpus
cc640c86-42d4-443d-ba2c-ef2c12ab29ba
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,490
supabase-export-v2
c8dc969573918b16
---------------------- Keyword-Only Arguments ---------------------- To mark parameters as *keyword-only*, indicating the parameters must be passed by keyword argument, place an ``*`` in the arguments list just before the first *keyword-only* parameter.
trusted_official_docs
CPython Docs
---------------------- Keyword-Only Arguments ---------------------- To mark parameters as *keyword-only*, indicating the parameters must be passed by keyword argument, place an ``*`` in the arguments list just before the first *keyword-only* parameter.
---------------------- Keyword-Only Arguments ---------------------- To mark parameters as *keyword-only*, indicating the parameters must be passed by keyword argument, place an ``*`` in the arguments list just before the first *keyword-only* parameter.
python, official-docs, cpython, P0
Local_Trusted_Corpus
cdb72874-adb0-4d21-9ae2-0a30fb8cbddf
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,526
supabase-export-v2
aaaa1450c0d0cf25
formal parameters which occur after the ``*args`` parameter are 'keyword-only' arguments, meaning that they can only be used as keywords rather than positional arguments. :: >>> def concat(*args, sep="/"): ... return sep.join(args) ... >>> concat("earth", "mars", "venus") 'earth/mars/venus' >>> concat("earth", "mar...
trusted_official_docs
CPython Docs
formal parameters which occur after the ``*args`` parameter are 'keyword-only' arguments, meaning that they can only be used as keywords rather than positional arguments. :: >>> def concat(*args, sep="/"): ... return sep.join(args) ... >>> concat("earth", "mars", "venus") 'earth/mars/venus' >>> concat("earth", "mar...
formal parameters which occur after the ``*args`` parameter are 'keyword-only' arguments, meaning that they can only be used as keywords rather than positional arguments. :: >>> def concat(*args, sep="/"): ... return sep.join(args) ... >>> concat("earth", "mars", "venus") 'earth/mars/venus' >>> concat("earth", "mar...
python, official-docs, cpython, P0
Local_Trusted_Corpus
cf8642d4-aeee-403d-9726-82b56807f0d9
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,366
supabase-export-v2
b2246b20f2bcf7ab
The :keyword:`break` statement breaks out of the innermost enclosing :keyword:`for` or :keyword:`while` loop:: >>> for n in range(2, 10): ... for x in range(2, n): ... if n % x == 0: ... print(f"{n} equals {x} * {n//x}") ... break ... 4 equals 2 * 2 6 equals 2 * 3 8 equals 2 * 4 9 equals 3 * 3
trusted_official_docs
CPython Docs
The :keyword:`break` statement breaks out of the innermost enclosing :keyword:`for` or :keyword:`while` loop:: >>> for n in range(2, 10): ... for x in range(2, n): ... if n % x == 0: ... print(f"{n} equals {x} * {n//x}") ... break ... 4 equals 2 * 2 6 equals 2 * 3 8 equals 2 * 4 9 equals 3 * 3
The :keyword:`break` statement breaks out of the innermost enclosing :keyword:`for` or :keyword:`while` loop:: >>> for n in range(2, 10): ... for x in range(2, n): ... if n % x == 0: ... print(f"{n} equals {x} * {n//x}") ... break ... 4 equals 2 * 2 6 equals 2 * 3 8 equals 2 * 4 9 equals 3 * 3
python, official-docs, cpython, P0
Local_Trusted_Corpus
d048a99b-fd1a-44ed-8e83-9e3cb58eb9fe
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,472
supabase-export-v2
8de74f8049f608cf
kind, "?") print("-- I'm sorry, we're all out of", kind) for arg in arguments: print(arg) print("-" * 40) for kw in keywords: print(kw, ":", keywords[kw]) It could be called like this::
trusted_official_docs
CPython Docs
kind, "?") print("-- I'm sorry, we're all out of", kind) for arg in arguments: print(arg) print("-" * 40) for kw in keywords: print(kw, ":", keywords[kw]) It could be called like this::
kind, "?") print("-- I'm sorry, we're all out of", kind) for arg in arguments: print(arg) print("-" * 40) for kw in keywords: print(kw, ":", keywords[kw]) It could be called like this::
python, official-docs, cpython, P0
Local_Trusted_Corpus
d11994cb-080e-4971-9e28-ef9783f6c513
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,415
supabase-export-v2
518019dbefe7927f
dictionary. Unlike sequence patterns, extra keys are ignored. An unpacking like ``**rest`` is also supported. (But ``**_`` would be redundant, so it is not allowed.) - Subpatterns may be captured using the ``as`` keyword::
trusted_official_docs
CPython Docs
dictionary. Unlike sequence patterns, extra keys are ignored. An unpacking like ``**rest`` is also supported. (But ``**_`` would be redundant, so it is not allowed.) - Subpatterns may be captured using the ``as`` keyword::
dictionary. Unlike sequence patterns, extra keys are ignored. An unpacking like ``**rest`` is also supported. (But ``**_`` would be redundant, so it is not allowed.) - Subpatterns may be captured using the ``as`` keyword::
python, official-docs, cpython, P0
Local_Trusted_Corpus
d23fff44-a4d7-43de-8924-3084decd8d40
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,368
supabase-export-v2
fd5301351b1f6db3
The :keyword:`continue` statement continues with the next iteration of the loop:: >>> for num in range(2, 10): ... if num % 2 == 0: ... print(f"Found an even number {num}") ... continue ... print(f"Found an odd number {num}") ... Found an even number 2 Found an odd number 3 Found an even number 4 Found an odd n...
trusted_official_docs
CPython Docs
The :keyword:`continue` statement continues with the next iteration of the loop:: >>> for num in range(2, 10): ... if num % 2 == 0: ... print(f"Found an even number {num}") ... continue ... print(f"Found an odd number {num}") ... Found an even number 2 Found an odd number 3 Found an even number 4 Found an odd n...
The :keyword:`continue` statement continues with the next iteration of the loop:: >>> for num in range(2, 10): ... if num % 2 == 0: ... print(f"Found an even number {num}") ... continue ... print(f"Found an odd number {num}") ... Found an even number 2 Found an odd number 3 Found an even number 4 Found an odd n...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d2e59233-03d4-493a-8bc9-b3a7802c5313
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,440
supabase-export-v2
b1e331a5827c65f5
This example, as usual, demonstrates some new Python features: * The :keyword:`return` statement returns with a value from a function. :keyword:`!return` without an expression argument returns ``None``. Falling off the end of a function also returns ``None``.
trusted_official_docs
CPython Docs
This example, as usual, demonstrates some new Python features: * The :keyword:`return` statement returns with a value from a function. :keyword:`!return` without an expression argument returns ``None``. Falling off the end of a function also returns ``None``.
This example, as usual, demonstrates some new Python features: * The :keyword:`return` statement returns with a value from a function. :keyword:`!return` without an expression argument returns ``None``. Falling off the end of a function also returns ``None``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
d9911026-84aa-4c72-bf6d-6bd2f3f59a18
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,512
supabase-export-v2
bfdaa1e6623ea3ce
>>> foo(1, **{'name': 2}) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: foo() got multiple values for argument 'name' >>> But using ``/`` (positional only arguments), it is possible since it allows ``name`` as a positional argument and ``'name'`` as a key in the keyword arguments::
trusted_official_docs
CPython Docs
>>> foo(1, **{'name': 2}) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: foo() got multiple values for argument 'name' >>> But using ``/`` (positional only arguments), it is possible since it allows ``name`` as a positional argument and ``'name'`` as a key in the keyword arguments::
>>> foo(1, **{'name': 2}) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: foo() got multiple values for argument 'name' >>> But using ``/`` (positional only arguments), it is possible since it allows ``name`` as a positional argument and ``'name'`` as a key in the keyword arguments::
python, official-docs, cpython, P0
Local_Trusted_Corpus
db71e4ce-b673-4960-a998-4c51b5077352
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,494
supabase-export-v2
46a5de7732d6a53c
>>> def pos_only_arg(arg, /): ... print(arg) ... >>> def kwd_only_arg(*, arg): ... print(arg) ... >>> def combined_example(pos_only, /, standard, *, kwd_only): ... print(pos_only, standard, kwd_only) The first function definition, ``standard_arg``, the most familiar form, places no restrictions on the calling conventio...
trusted_official_docs
CPython Docs
>>> def pos_only_arg(arg, /): ... print(arg) ... >>> def kwd_only_arg(*, arg): ... print(arg) ... >>> def combined_example(pos_only, /, standard, *, kwd_only): ... print(pos_only, standard, kwd_only) The first function definition, ``standard_arg``, the most familiar form, places no restrictions on the calling conventio...
>>> def pos_only_arg(arg, /): ... print(arg) ... >>> def kwd_only_arg(*, arg): ... print(arg) ... >>> def combined_example(pos_only, /, standard, *, kwd_only): ... print(pos_only, standard, kwd_only) The first function definition, ``standard_arg``, the most familiar form, places no restrictions on the calling conventio...
python, official-docs, cpython, P0
Local_Trusted_Corpus
dbb69a8e-6b85-4d02-be58-6730f35f89bf
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,504
supabase-export-v2
d6d8192bc175625f
And the last uses all three calling conventions in the same function definition:: >>> combined_example(1, 2, 3) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: combined_example() takes 2 positional arguments but 3 were given
trusted_official_docs
CPython Docs
And the last uses all three calling conventions in the same function definition:: >>> combined_example(1, 2, 3) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: combined_example() takes 2 positional arguments but 3 were given
And the last uses all three calling conventions in the same function definition:: >>> combined_example(1, 2, 3) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: combined_example() takes 2 positional arguments but 3 were given
python, official-docs, cpython, P0
Local_Trusted_Corpus
dcd4e383-b0cc-4ba6-b636-59da6651e644
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,471
supabase-export-v2
ca8630f0abf964f4
:ref:`tuple <tut-tuples>` containing the positional arguments beyond the formal parameter list. (``*name`` must occur before ``**name``.) For example, if we define a function like this:: def cheeseshop(kind, *arguments, **keywords): print("-- Do you have any", kind, "?") print("-- I'm sorry, we're all out of", kind) ...
trusted_official_docs
CPython Docs
:ref:`tuple <tut-tuples>` containing the positional arguments beyond the formal parameter list. (``*name`` must occur before ``**name``.) For example, if we define a function like this:: def cheeseshop(kind, *arguments, **keywords): print("-- Do you have any", kind, "?") print("-- I'm sorry, we're all out of", kind) ...
:ref:`tuple <tut-tuples>` containing the positional arguments beyond the formal parameter list. (``*name`` must occur before ``**name``.) For example, if we define a function like this:: def cheeseshop(kind, *arguments, **keywords): print("-- Do you have any", kind, "?") print("-- I'm sorry, we're all out of", kind) ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
df0532c7-e28e-4cfc-9752-62d9e845d64a
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,414
supabase-export-v2
cd329830129785d5
The name after ``*`` may also be ``_``, so ``(x, y, *_)`` matches a sequence of at least two items without binding the remaining items. - Mapping patterns: ``{"bandwidth": b, "latency": l}`` captures the ``"bandwidth"`` and ``"latency"`` values from a dictionary. Unlike sequence patterns, extra keys are ignored. An u...
trusted_official_docs
CPython Docs
The name after ``*`` may also be ``_``, so ``(x, y, *_)`` matches a sequence of at least two items without binding the remaining items. - Mapping patterns: ``{"bandwidth": b, "latency": l}`` captures the ``"bandwidth"`` and ``"latency"`` values from a dictionary. Unlike sequence patterns, extra keys are ignored. An u...
The name after ``*`` may also be ``_``, so ``(x, y, *_)`` matches a sequence of at least two items without binding the remaining items. - Mapping patterns: ``{"bandwidth": b, "latency": l}`` captures the ``"bandwidth"`` and ``"latency"`` values from a dictionary. Unlike sequence patterns, extra keys are ignored. An u...
python, official-docs, cpython, P0
Local_Trusted_Corpus
df1f5305-c870-4ce5-8aa3-5295590a287d
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,342
supabase-export-v2
6d4986bfc8397678
# Measure some strings: >>> words = ['cat', 'window', 'defenestrate'] >>> for w in words: ... print(w, len(w)) ... cat 3 window 6 defenestrate 12 Code that modifies a collection while iterating over that same collection can be tricky to get right. Instead, it is usually more straight-forward to loop over a copy of the ...
trusted_official_docs
CPython Docs
# Measure some strings: >>> words = ['cat', 'window', 'defenestrate'] >>> for w in words: ... print(w, len(w)) ... cat 3 window 6 defenestrate 12 Code that modifies a collection while iterating over that same collection can be tricky to get right. Instead, it is usually more straight-forward to loop over a copy of the ...
# Measure some strings: >>> words = ['cat', 'window', 'defenestrate'] >>> for w in words: ... print(w, len(w)) ... cat 3 window 6 defenestrate 12 Code that modifies a collection while iterating over that same collection can be tricky to get right. Instead, it is usually more straight-forward to loop over a copy of the ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e03f900c-e7ae-4581-a2f9-709bb3d56ecc
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,344
supabase-export-v2
f8fb0e7fbb963361
# Create a sample collection users = {'Hans': 'active', 'Éléonore': 'inactive', '景太郎': 'active'} # Strategy: Iterate over a copy for user, status in users.copy().items(): if status == 'inactive': del users[user]
trusted_official_docs
CPython Docs
# Create a sample collection users = {'Hans': 'active', 'Éléonore': 'inactive', '景太郎': 'active'} # Strategy: Iterate over a copy for user, status in users.copy().items(): if status == 'inactive': del users[user]
# Create a sample collection users = {'Hans': 'active', 'Éléonore': 'inactive', '景太郎': 'active'} # Strategy: Iterate over a copy for user, status in users.copy().items(): if status == 'inactive': del users[user]
python, official-docs, cpython, P0
Local_Trusted_Corpus
e09a2118-1ba1-4ea4-a2b7-1f2b0bc0187b
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,427
supabase-export-v2
f83a1a18de886457
We can create a function that writes the Fibonacci series to an arbitrary boundary:: >>> def fib(n): # write Fibonacci series less than n ... """Print a Fibonacci series less than n.""" ... a, b = 0, 1 ... while a < n: ... print(a, end=' ') ... a, b = b, a+b ... print() ... >>> # Now call the function we just de...
trusted_official_docs
CPython Docs
We can create a function that writes the Fibonacci series to an arbitrary boundary:: >>> def fib(n): # write Fibonacci series less than n ... """Print a Fibonacci series less than n.""" ... a, b = 0, 1 ... while a < n: ... print(a, end=' ') ... a, b = b, a+b ... print() ... >>> # Now call the function we just de...
We can create a function that writes the Fibonacci series to an arbitrary boundary:: >>> def fib(n): # write Fibonacci series less than n ... """Print a Fibonacci series less than n.""" ... a, b = 0, 1 ... while a < n: ... print(a, end=' ') ... a, b = b, a+b ... print() ... >>> # Now call the function we just de...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e177cee0-730b-4692-bde2-b41f4b709775
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,412
supabase-export-v2
947099bab6a0aaae
Several other key features of this statement: - Like unpacking assignments, tuple and list patterns have exactly the same meaning and actually match arbitrary sequences. An important exception is that they don't match iterators or strings.
trusted_official_docs
CPython Docs
Several other key features of this statement: - Like unpacking assignments, tuple and list patterns have exactly the same meaning and actually match arbitrary sequences. An important exception is that they don't match iterators or strings.
Several other key features of this statement: - Like unpacking assignments, tuple and list patterns have exactly the same meaning and actually match arbitrary sequences. An important exception is that they don't match iterators or strings.
python, official-docs, cpython, P0
Local_Trusted_Corpus
e5ad8165-eb92-4efd-b094-6d6a6461437b
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,470
supabase-export-v2
b3f6824040fd744c
... pass ... >>> function(0, a=0) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: function() got multiple values for argument 'a' When a final formal parameter of the form ``**name`` is present, it receives a dictionary (see :ref:`typesmapping`) containing all keyword arguments except ...
trusted_official_docs
CPython Docs
... pass ... >>> function(0, a=0) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: function() got multiple values for argument 'a' When a final formal parameter of the form ``**name`` is present, it receives a dictionary (see :ref:`typesmapping`) containing all keyword arguments except ...
... pass ... >>> function(0, a=0) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: function() got multiple values for argument 'a' When a final formal parameter of the form ``**name`` is present, it receives a dictionary (see :ref:`typesmapping`) containing all keyword arguments except ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e72c45cd-a264-4dcd-9950-c702910abd5e
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,449
supabase-export-v2
44ad5857d74c9148
return True if reply in {'n', 'no', 'nop', 'nope'}: return False retries = retries - 1 if retries < 0: raise ValueError('invalid user response') print(reminder) This function can be called in several ways:
trusted_official_docs
CPython Docs
return True if reply in {'n', 'no', 'nop', 'nope'}: return False retries = retries - 1 if retries < 0: raise ValueError('invalid user response') print(reminder) This function can be called in several ways:
return True if reply in {'n', 'no', 'nop', 'nope'}: return False retries = retries - 1 if retries < 0: raise ValueError('invalid user response') print(reminder) This function can be called in several ways:
python, official-docs, cpython, P0
Local_Trusted_Corpus
e8ea1267-6979-431a-9e3d-d283a4ff298d
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,407
supabase-export-v2
7cbaaadc4227f7a8
Patterns can be arbitrarily nested. For example, if we have a short list of Points, with ``__match_args__`` added, we could match it like this:: class Point: __match_args__ = ('x', 'y') def __init__(self, x, y): self.x = x self.y = y
trusted_official_docs
CPython Docs
Patterns can be arbitrarily nested. For example, if we have a short list of Points, with ``__match_args__`` added, we could match it like this:: class Point: __match_args__ = ('x', 'y') def __init__(self, x, y): self.x = x self.y = y
Patterns can be arbitrarily nested. For example, if we have a short list of Points, with ``__match_args__`` added, we could match it like this:: class Point: __match_args__ = ('x', 'y') def __init__(self, x, y): self.x = x self.y = y
python, official-docs, cpython, P0
Local_Trusted_Corpus
e8ff09db-96dd-4575-bf7e-6cc8e17f50ea
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,438
supabase-export-v2
58828496e1d8963d
It is simple to write a function that returns a list of the numbers of the Fibonacci series, instead of printing it:: >>> def fib2(n): # return Fibonacci series up to n ... """Return a list containing the Fibonacci series up to n.""" ... result = [] ... a, b = 0, 1 ... while a < n: ... result.append(a) # see below...
trusted_official_docs
CPython Docs
It is simple to write a function that returns a list of the numbers of the Fibonacci series, instead of printing it:: >>> def fib2(n): # return Fibonacci series up to n ... """Return a list containing the Fibonacci series up to n.""" ... result = [] ... a, b = 0, 1 ... while a < n: ... result.append(a) # see below...
It is simple to write a function that returns a list of the numbers of the Fibonacci series, instead of printing it:: >>> def fib2(n): # return Fibonacci series up to n ... """Return a list containing the Fibonacci series up to n.""" ... result = [] ... a, b = 0, 1 ... while a < n: ... result.append(a) # see below...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ea095230-f6f3-4ab6-b909-d06c9921c652
CPython Docs
file://datasets/cpython/Doc/tutorial/controlflow.rst
unknown
d304f339-96c1-4452-8a50-5478780d9bd7
53,431
supabase-export-v2
b713835128e22cc6
to let the user interactively browse through code; it's good practice to include docstrings in code that you write, so make a habit of it. The *execution* of a function introduces a new symbol table used for the local variables of the function. More precisely, all variable assignments in a function store the value in t...
trusted_official_docs
CPython Docs
to let the user interactively browse through code; it's good practice to include docstrings in code that you write, so make a habit of it. The *execution* of a function introduces a new symbol table used for the local variables of the function. More precisely, all variable assignments in a function store the value in t...
to let the user interactively browse through code; it's good practice to include docstrings in code that you write, so make a habit of it. The *execution* of a function introduces a new symbol table used for the local variables of the function. More precisely, all variable assignments in a function store the value in t...
python, official-docs, cpython, P0
Local_Trusted_Corpus