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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3988a0c8-9e38-4b24-9982-e96769598688 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,252 | supabase-export-v2 | a72a799a84fc294c | Quality control ===============
One approach for developing high quality software is to write tests for each
function as it is developed and to run those tests frequently during the
development process. | trusted_official_docs | CPython Docs | Quality control ===============
One approach for developing high quality software is to write tests for each
function as it is developed and to run those tests frequently during the
development process. | Quality control ===============
One approach for developing high quality software is to write tests for each
function as it is developed and to run those tests frequently during the
development process. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3d6656db-c783-4c2b-9f23-4a21aeaeaade | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,202 | supabase-export-v2 | 7310ff436a44253a | Command-line arguments ======================
Common utility scripts often need to process command line arguments. These
arguments are stored in the :mod:`sys` module's *argv* attribute as a list. For
instance, let's take the following :file:`demo.py` file:: | trusted_official_docs | CPython Docs | Command-line arguments ======================
Common utility scripts often need to process command line arguments. These
arguments are stored in the :mod:`sys` module's *argv* attribute as a list. For
instance, let's take the following :file:`demo.py` file:: | Command-line arguments ======================
Common utility scripts often need to process command line arguments. These
arguments are stored in the :mod:`sys` module's *argv* attribute as a list. For
instance, let's take the following :file:`demo.py` file:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
47a58bf5-7a34-44cc-abae-9450bb3883e3 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,189 | supabase-export-v2 | 635c8f00ac1f755d | The :mod:`os` module provides dozens of functions for interacting with the operating system::
>>> import os
>>> os.getcwd() # Return the current working directory
'C:\\Python315'
>>> os.chdir('/server/accesslogs') # Change current working directory
>>> os.system('mkdir today') # Run the command mkdir in the system ... | trusted_official_docs | CPython Docs | The :mod:`os` module provides dozens of functions for interacting with the operating system::
>>> import os
>>> os.getcwd() # Return the current working directory
'C:\\Python315'
>>> os.chdir('/server/accesslogs') # Change current working directory
>>> os.system('mkdir today') # Run the command mkdir in the system ... | The :mod:`os` module provides dozens of functions for interacting with the operating system::
>>> import os
>>> os.getcwd() # Return the current working directory
'C:\\Python315'
>>> os.chdir('/server/accesslogs') # Change current working directory
>>> os.system('mkdir today') # Run the command mkdir in the system ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
49caaeba-03ce-4d0d-8f0f-f702ecd76b09 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,193 | supabase-export-v2 | 47d216ab3136e511 | The built-in :func:`dir` and :func:`help` functions are useful as interactive aids for working with large modules like :mod:`os`::
>>> import os
>>> dir(os)
<returns a list of all module functions>
>>> help(os)
<returns an extensive manual page created from the module's docstrings> | trusted_official_docs | CPython Docs | The built-in :func:`dir` and :func:`help` functions are useful as interactive aids for working with large modules like :mod:`os`::
>>> import os
>>> dir(os)
<returns a list of all module functions>
>>> help(os)
<returns an extensive manual page created from the module's docstrings> | The built-in :func:`dir` and :func:`help` functions are useful as interactive aids for working with large modules like :mod:`os`::
>>> import os
>>> dir(os)
<returns a list of all module functions>
>>> help(os)
<returns an extensive manual page created from the module's docstrings> | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
50f38474-ca45-4db2-bfb7-40570c53b23e | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,249 | supabase-export-v2 | 285564001c38dd13 | >>> from timeit import Timer >>> Timer('t=a; a=b; b=t', 'a=1; b=2').timeit() 0.57535828626024577 >>> Timer('a,b = b,a', 'a=1; b=2').timeit() 0.54962537085770791
In contrast to :mod:`timeit`'s fine level of granularity, the :mod:`profile` and
:mod:`pstats` modules provide tools for identifying time critical sections in
... | trusted_official_docs | CPython Docs | >>> from timeit import Timer >>> Timer('t=a; a=b; b=t', 'a=1; b=2').timeit() 0.57535828626024577 >>> Timer('a,b = b,a', 'a=1; b=2').timeit() 0.54962537085770791
In contrast to :mod:`timeit`'s fine level of granularity, the :mod:`profile` and
:mod:`pstats` modules provide tools for identifying time critical sections in
... | >>> from timeit import Timer >>> Timer('t=a; a=b; b=t', 'a=1; b=2').timeit() 0.57535828626024577 >>> Timer('a,b = b,a', 'a=1; b=2').timeit() 0.54962537085770791
In contrast to :mod:`timeit`'s fine level of granularity, the :mod:`profile` and
:mod:`pstats` modules provide tools for identifying time critical sections in
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
57ba6364-a70a-4c2d-aca7-02eafd677592 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,254 | supabase-export-v2 | 831813ab8f80f10d | the documentation by providing the user with an example and it allows the doctest module to make sure the code remains true to the documentation::
def average(values):
"""Computes the arithmetic mean of a list of numbers. | trusted_official_docs | CPython Docs | the documentation by providing the user with an example and it allows the doctest module to make sure the code remains true to the documentation::
def average(values):
"""Computes the arithmetic mean of a list of numbers. | the documentation by providing the user with an example and it allows the doctest module to make sure the code remains true to the documentation::
def average(values):
"""Computes the arithmetic mean of a list of numbers. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
63d21ae5-8b93-4381-a960-f60f41d6eaf0 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,248 | supabase-export-v2 | 821e84004de099e8 | to use the tuple packing and unpacking feature instead of the traditional approach to swapping arguments. The :mod:`timeit` module quickly demonstrates a modest performance advantage::
>>> from timeit import Timer
>>> Timer('t=a; a=b; b=t', 'a=1; b=2').timeit()
0.57535828626024577
>>> Timer('a,b = b,a', 'a=1; b=2').... | trusted_official_docs | CPython Docs | to use the tuple packing and unpacking feature instead of the traditional approach to swapping arguments. The :mod:`timeit` module quickly demonstrates a modest performance advantage::
>>> from timeit import Timer
>>> Timer('t=a; a=b; b=t', 'a=1; b=2').timeit()
0.57535828626024577
>>> Timer('a,b = b,a', 'a=1; b=2').... | to use the tuple packing and unpacking feature instead of the traditional approach to swapping arguments. The :mod:`timeit` module quickly demonstrates a modest performance advantage::
>>> from timeit import Timer
>>> Timer('t=a; a=b; b=t', 'a=1; b=2').timeit()
0.57535828626024577
>>> Timer('a,b = b,a', 'a=1; b=2').... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
662d4301-945d-4254-83cb-9980c1dcaeab | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,212 | supabase-export-v2 | 0006180a3ad90238 | Error output redirection and program termination ================================================
The :mod:`sys` module also has attributes for *stdin*, *stdout*, and *stderr*. The latter is useful for emitting warnings and error messages to make them
visible even when *stdout* has been redirected:: | trusted_official_docs | CPython Docs | Error output redirection and program termination ================================================
The :mod:`sys` module also has attributes for *stdin*, *stdout*, and *stderr*. The latter is useful for emitting warnings and error messages to make them
visible even when *stdout* has been redirected:: | Error output redirection and program termination ================================================
The :mod:`sys` module also has attributes for *stdin*, *stdout*, and *stderr*. The latter is useful for emitting warnings and error messages to make them
visible even when *stdout* has been redirected:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7f5cdde4-add1-4728-9a31-1835beacfa55 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,214 | supabase-export-v2 | aebdce61507af6d7 | >>> sys.stderr.write('Warning, log file not found starting a new one\n') Warning, log file not found starting a new one
The most direct way to terminate a script is to use ``sys.exit()``. | trusted_official_docs | CPython Docs | >>> sys.stderr.write('Warning, log file not found starting a new one\n') Warning, log file not found starting a new one
The most direct way to terminate a script is to use ``sys.exit()``. | >>> sys.stderr.write('Warning, log file not found starting a new one\n') Warning, log file not found starting a new one
The most direct way to terminate a script is to use ``sys.exit()``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8a947c44-4851-451a-a678-db5e3bea201b | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,213 | supabase-export-v2 | 5ecb8775eedb2da4 | for *stdin*, *stdout*, and *stderr*. The latter is useful for emitting warnings and error messages to make them visible even when *stdout* has been redirected::
>>> sys.stderr.write('Warning, log file not found starting a new one\n')
Warning, log file not found starting a new one | trusted_official_docs | CPython Docs | for *stdin*, *stdout*, and *stderr*. The latter is useful for emitting warnings and error messages to make them visible even when *stdout* has been redirected::
>>> sys.stderr.write('Warning, log file not found starting a new one\n')
Warning, log file not found starting a new one | for *stdin*, *stdout*, and *stderr*. The latter is useful for emitting warnings and error messages to make them visible even when *stdout* has been redirected::
>>> sys.stderr.write('Warning, log file not found starting a new one\n')
Warning, log file not found starting a new one | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8ac92be1-721d-43e3-9bb5-36ce48b98d60 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,257 | supabase-export-v2 | 8fe9965b32a9ff9b | import doctest doctest.testmod() # automatically validate the embedded tests
The :mod:`unittest` module is not as effortless as the :mod:`doctest` module,
but it allows a more comprehensive set of tests to be maintained in a separate
file:: | trusted_official_docs | CPython Docs | import doctest doctest.testmod() # automatically validate the embedded tests
The :mod:`unittest` module is not as effortless as the :mod:`doctest` module,
but it allows a more comprehensive set of tests to be maintained in a separate
file:: | import doctest doctest.testmod() # automatically validate the embedded tests
The :mod:`unittest` module is not as effortless as the :mod:`doctest` module,
but it allows a more comprehensive set of tests to be maintained in a separate
file:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8daec37b-fce6-4d89-a4aa-5f4293141a85 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,231 | supabase-export-v2 | 7316012f8e6fa108 | Internet access ===============
There are a number of modules for accessing the internet and processing internet
protocols. Two of the simplest are :mod:`urllib.request` for retrieving data
from URLs and :mod:`smtplib` for sending mail:: | trusted_official_docs | CPython Docs | Internet access ===============
There are a number of modules for accessing the internet and processing internet
protocols. Two of the simplest are :mod:`urllib.request` for retrieving data
from URLs and :mod:`smtplib` for sending mail:: | Internet access ===============
There are a number of modules for accessing the internet and processing internet
protocols. Two of the simplest are :mod:`urllib.request` for retrieving data
from URLs and :mod:`smtplib` for sending mail:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8e08e1d0-babe-487e-8479-ee44b4e2328c | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,234 | supabase-export-v2 | 32899867bdaf1645 | smtplib >>> server = smtplib.SMTP('localhost') >>> server.sendmail('soothsayer@example.org', 'jcaesar@example.org', ... """To: jcaesar@example.org ... From: soothsayer@example.org ... ... Beware the Ides of March. ... """) >>> server.quit()
(Note that the second example needs a mailserver running on localhost.) | trusted_official_docs | CPython Docs | smtplib >>> server = smtplib.SMTP('localhost') >>> server.sendmail('soothsayer@example.org', 'jcaesar@example.org', ... """To: jcaesar@example.org ... From: soothsayer@example.org ... ... Beware the Ides of March. ... """) >>> server.quit()
(Note that the second example needs a mailserver running on localhost.) | smtplib >>> server = smtplib.SMTP('localhost') >>> server.sendmail('soothsayer@example.org', 'jcaesar@example.org', ... """To: jcaesar@example.org ... From: soothsayer@example.org ... ... Beware the Ides of March. ... """) >>> server.quit()
(Note that the second example needs a mailserver running on localhost.) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
923c182e-dce7-4a95-8caa-26dafa0370d8 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,233 | supabase-export-v2 | 711ff02e12ce341c | Convert bytes to a str ... if 'updated' in line: ... print(line.rstrip()) # Remove trailing newline ... Last updated on Nov 11, 2025 (20:11 UTC).
>>> import smtplib
>>> server = smtplib.SMTP('localhost')
>>> server.sendmail('soothsayer@example.org', 'jcaesar@example.org',
... """To: jcaesar@example.org
... From: so... | trusted_official_docs | CPython Docs | Convert bytes to a str ... if 'updated' in line: ... print(line.rstrip()) # Remove trailing newline ... Last updated on Nov 11, 2025 (20:11 UTC).
>>> import smtplib
>>> server = smtplib.SMTP('localhost')
>>> server.sendmail('soothsayer@example.org', 'jcaesar@example.org',
... """To: jcaesar@example.org
... From: so... | Convert bytes to a str ... if 'updated' in line: ... print(line.rstrip()) # Remove trailing newline ... Last updated on Nov 11, 2025 (20:11 UTC).
>>> import smtplib
>>> server = smtplib.SMTP('localhost')
>>> server.sendmail('soothsayer@example.org', 'jcaesar@example.org',
... """To: jcaesar@example.org
... From: so... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
94555bc2-b2f3-48b4-a504-9de1158c05ce | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,206 | supabase-export-v2 | b364a0d895d7cc64 | ['demo.py', 'one', 'two', 'three']
The :mod:`argparse` module provides a more sophisticated mechanism to process
command line arguments. The following script extracts one or more filenames
and an optional number of lines to be displayed:: | trusted_official_docs | CPython Docs | ['demo.py', 'one', 'two', 'three']
The :mod:`argparse` module provides a more sophisticated mechanism to process
command line arguments. The following script extracts one or more filenames
and an optional number of lines to be displayed:: | ['demo.py', 'one', 'two', 'three']
The :mod:`argparse` module provides a more sophisticated mechanism to process
command line arguments. The following script extracts one or more filenames
and an optional number of lines to be displayed:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9a6b5e8c-de5d-442e-9726-c509a39795e0 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,218 | supabase-export-v2 | 3e14a35e42d76fb5 | The :mod:`re` module provides regular expression tools for advanced string processing. For complex matching and manipulation, regular expressions offer succinct, optimized solutions::
>>> import re
>>> re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest')
['foot', 'fell', 'fastest']
>>> re.sub(r'(\b[a-z]+) \1'... | trusted_official_docs | CPython Docs | The :mod:`re` module provides regular expression tools for advanced string processing. For complex matching and manipulation, regular expressions offer succinct, optimized solutions::
>>> import re
>>> re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest')
['foot', 'fell', 'fastest']
>>> re.sub(r'(\b[a-z]+) \1'... | The :mod:`re` module provides regular expression tools for advanced string processing. For complex matching and manipulation, regular expressions offer succinct, optimized solutions::
>>> import re
>>> re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest')
['foot', 'fell', 'fastest']
>>> re.sub(r'(\b[a-z]+) \1'... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9c9b5f8d-73ef-4e32-bd34-8c1910191947 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,227 | supabase-export-v2 | 33788c7ada6f2ea0 | The :mod:`statistics` module calculates basic statistical properties (the mean, median, variance, etc.) of numeric data::
>>> import statistics
>>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]
>>> statistics.mean(data)
1.6071428571428572
>>> statistics.median(data)
1.25
>>> statistics.variance(data)
1.3720238... | trusted_official_docs | CPython Docs | The :mod:`statistics` module calculates basic statistical properties (the mean, median, variance, etc.) of numeric data::
>>> import statistics
>>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]
>>> statistics.mean(data)
1.6071428571428572
>>> statistics.median(data)
1.25
>>> statistics.variance(data)
1.3720238... | The :mod:`statistics` module calculates basic statistical properties (the mean, median, variance, etc.) of numeric data::
>>> import statistics
>>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]
>>> statistics.mean(data)
1.6071428571428572
>>> statistics.median(data)
1.25
>>> statistics.variance(data)
1.3720238... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ad7ed251-e802-4c97-a58b-7c2b6fc8295d | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,246 | supabase-export-v2 | a36d52b6cc3c9eef | Performance measurement =======================
Some Python users develop a deep interest in knowing the relative performance of
different approaches to the same problem. Python provides a measurement tool
that answers those questions immediately. | trusted_official_docs | CPython Docs | Performance measurement =======================
Some Python users develop a deep interest in knowing the relative performance of
different approaches to the same problem. Python provides a measurement tool
that answers those questions immediately. | Performance measurement =======================
Some Python users develop a deep interest in knowing the relative performance of
different approaches to the same problem. Python provides a measurement tool
that answers those questions immediately. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
adde156d-8429-4d46-98be-8704b005cc04 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,267 | supabase-export-v2 | 1424809eee15a6e3 | messages, the email package has a complete toolset for building or decoding complex message structures (including attachments) and for implementing internet encoding and header protocols.
* The :mod:`json` package provides robust support for parsing this
popular data interchange format. The :mod:`csv` module supports
... | trusted_official_docs | CPython Docs | messages, the email package has a complete toolset for building or decoding complex message structures (including attachments) and for implementing internet encoding and header protocols.
* The :mod:`json` package provides robust support for parsing this
popular data interchange format. The :mod:`csv` module supports
... | messages, the email package has a complete toolset for building or decoding complex message structures (including attachments) and for implementing internet encoding and header protocols.
* The :mod:`json` package provides robust support for parsing this
popular data interchange format. The :mod:`csv` module supports
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b5747173-a1b3-4659-8d82-c10332791095 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,239 | supabase-export-v2 | 32e73e654941a296 | %d %b %Y is a %A on the %d day of %B.") '12-02-03. 02 Dec 2003 is a Tuesday on the 02 day of December.'
>>> # dates support calendar arithmetic
>>> birthday = dt.date(1964, 7, 31)
>>> age = now - birthday
>>> age.days
14368 | trusted_official_docs | CPython Docs | %d %b %Y is a %A on the %d day of %B.") '12-02-03. 02 Dec 2003 is a Tuesday on the 02 day of December.'
>>> # dates support calendar arithmetic
>>> birthday = dt.date(1964, 7, 31)
>>> age = now - birthday
>>> age.days
14368 | %d %b %Y is a %A on the %d day of %B.") '12-02-03. 02 Dec 2003 is a Tuesday on the 02 day of December.'
>>> # dates support calendar arithmetic
>>> birthday = dt.date(1964, 7, 31)
>>> age = now - birthday
>>> age.days
14368 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bc5ea7fa-046d-4209-9f32-466b73b30a10 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,194 | supabase-export-v2 | afcfc2638d0c7faa | >>> import os >>> dir(os) <returns a list of all module functions> >>> help(os) <returns an extensive manual page created from the module's docstrings>
For daily file and directory management tasks, the :mod:`shutil` module provides
a higher level interface that is easier to use:: | trusted_official_docs | CPython Docs | >>> import os >>> dir(os) <returns a list of all module functions> >>> help(os) <returns an extensive manual page created from the module's docstrings>
For daily file and directory management tasks, the :mod:`shutil` module provides
a higher level interface that is easier to use:: | >>> import os >>> dir(os) <returns a list of all module functions> >>> help(os) <returns an extensive manual page created from the module's docstrings>
For daily file and directory management tasks, the :mod:`shutil` module provides
a higher level interface that is easier to use:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c42146d9-b64f-4dad-acfb-8c79ce4d9094 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,195 | supabase-export-v2 | 4d52b8033d32aa84 | For daily file and directory management tasks, the :mod:`shutil` module provides a higher level interface that is easier to use::
>>> import shutil
>>> shutil.copyfile('data.db', 'archive.db')
'archive.db'
>>> shutil.move('/build/executables', 'installdir')
'installdir' | trusted_official_docs | CPython Docs | For daily file and directory management tasks, the :mod:`shutil` module provides a higher level interface that is easier to use::
>>> import shutil
>>> shutil.copyfile('data.db', 'archive.db')
'archive.db'
>>> shutil.move('/build/executables', 'installdir')
'installdir' | For daily file and directory management tasks, the :mod:`shutil` module provides a higher level interface that is easier to use::
>>> import shutil
>>> shutil.copyfile('data.db', 'archive.db')
'archive.db'
>>> shutil.move('/build/executables', 'installdir')
'installdir' | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c6e4f01b-886f-4231-8aef-f085c30272bf | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,203 | supabase-export-v2 | fe4d5aeaf28ba2b5 | process command line arguments. These arguments are stored in the :mod:`sys` module's *argv* attribute as a list. For instance, let's take the following :file:`demo.py` file::
# File demo.py
import sys
print(sys.argv) | trusted_official_docs | CPython Docs | process command line arguments. These arguments are stored in the :mod:`sys` module's *argv* attribute as a list. For instance, let's take the following :file:`demo.py` file::
# File demo.py
import sys
print(sys.argv) | process command line arguments. These arguments are stored in the :mod:`sys` module's *argv* attribute as a list. For instance, let's take the following :file:`demo.py` file::
# File demo.py
import sys
print(sys.argv) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ca6a6cdd-7b90-4424-bd51-6f884a8c5ec6 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,243 | supabase-export-v2 | 48baed18d8dd5540 | Common data archiving and compression formats are directly supported by modules including: :mod:`zlib`, :mod:`gzip`, :mod:`bz2`, :mod:`lzma`, :mod:`zipfile` and :mod:`tarfile`. ::
>>> import zlib
>>> s = b'witch which has which witches wrist watch'
>>> len(s)
41
>>> t = zlib.compress(s)
>>> len(t)
37
>>> zlib.de... | trusted_official_docs | CPython Docs | Common data archiving and compression formats are directly supported by modules including: :mod:`zlib`, :mod:`gzip`, :mod:`bz2`, :mod:`lzma`, :mod:`zipfile` and :mod:`tarfile`. ::
>>> import zlib
>>> s = b'witch which has which witches wrist watch'
>>> len(s)
41
>>> t = zlib.compress(s)
>>> len(t)
37
>>> zlib.de... | Common data archiving and compression formats are directly supported by modules including: :mod:`zlib`, :mod:`gzip`, :mod:`bz2`, :mod:`lzma`, :mod:`zipfile` and :mod:`tarfile`. ::
>>> import zlib
>>> s = b'witch which has which witches wrist watch'
>>> len(s)
41
>>> t = zlib.compress(s)
>>> len(t)
37
>>> zlib.de... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cd3517b1-1d06-4264-9e61-08cc44e76de4 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,209 | supabase-export-v2 | bf7f633b2e0dff3f | parser = argparse.ArgumentParser( prog='top', description='Show top lines from each file') parser.add_argument('filenames', nargs='+') parser.add_argument('-l', '--lines', type=int, default=10) args = parser.parse_args() print(args)
When run at the command line with ``python top.py --lines=5 alpha.txt
beta.txt``, the s... | trusted_official_docs | CPython Docs | parser = argparse.ArgumentParser( prog='top', description='Show top lines from each file') parser.add_argument('filenames', nargs='+') parser.add_argument('-l', '--lines', type=int, default=10) args = parser.parse_args() print(args)
When run at the command line with ``python top.py --lines=5 alpha.txt
beta.txt``, the s... | parser = argparse.ArgumentParser( prog='top', description='Show top lines from each file') parser.add_argument('filenames', nargs='+') parser.add_argument('-l', '--lines', type=int, default=10) args = parser.parse_args() print(args)
When run at the command line with ``python top.py --lines=5 alpha.txt
beta.txt``, the s... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d208f224-faa0-46e8-8270-9a9d95d658e0 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,268 | supabase-export-v2 | 399eeea61217d3cd | processing is supported by the :mod:`xml.etree.ElementTree`, :mod:`xml.dom` and :mod:`xml.sax` packages. Together, these modules and packages greatly simplify data interchange between Python applications and other tools.
* The :mod:`sqlite3` module is a wrapper for the SQLite database
library, providing a persistent d... | trusted_official_docs | CPython Docs | processing is supported by the :mod:`xml.etree.ElementTree`, :mod:`xml.dom` and :mod:`xml.sax` packages. Together, these modules and packages greatly simplify data interchange between Python applications and other tools.
* The :mod:`sqlite3` module is a wrapper for the SQLite database
library, providing a persistent d... | processing is supported by the :mod:`xml.etree.ElementTree`, :mod:`xml.dom` and :mod:`xml.sax` packages. Together, these modules and packages greatly simplify data interchange between Python applications and other tools.
* The :mod:`sqlite3` module is a wrapper for the SQLite database
library, providing a persistent d... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d904882a-144d-46eb-a612-3c6970e924c1 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,253 | supabase-export-v2 | f4b6acceea96098b | developing high quality software is to write tests for each function as it is developed and to run those tests frequently during the development process.
The :mod:`doctest` module provides a tool for scanning a module and validating
tests embedded in a program's docstrings. Test construction is as simple as
cutting-and... | trusted_official_docs | CPython Docs | developing high quality software is to write tests for each function as it is developed and to run those tests frequently during the development process.
The :mod:`doctest` module provides a tool for scanning a module and validating
tests embedded in a program's docstrings. Test construction is as simple as
cutting-and... | developing high quality software is to write tests for each function as it is developed and to run those tests frequently during the development process.
The :mod:`doctest` module provides a tool for scanning a module and validating
tests embedded in a program's docstrings. Test construction is as simple as
cutting-and... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d91dc746-9d17-47b7-be76-55e362ad869e | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,225 | supabase-export-v2 | 91ae2793054a5f1f | The :mod:`random` module provides tools for making random selections::
>>> import random
>>> random.choice(['apple', 'pear', 'banana'])
'apple'
>>> random.sample(range(100), 10) # sampling without replacement
[30, 83, 16, 4, 8, 81, 41, 50, 18, 33]
>>> random.random() # random float from the interval [0.0, 1.0)
0.... | trusted_official_docs | CPython Docs | The :mod:`random` module provides tools for making random selections::
>>> import random
>>> random.choice(['apple', 'pear', 'banana'])
'apple'
>>> random.sample(range(100), 10) # sampling without replacement
[30, 83, 16, 4, 8, 81, 41, 50, 18, 33]
>>> random.random() # random float from the interval [0.0, 1.0)
0.... | The :mod:`random` module provides tools for making random selections::
>>> import random
>>> random.choice(['apple', 'pear', 'banana'])
'apple'
>>> random.sample(range(100), 10) # sampling without replacement
[30, 83, 16, 4, 8, 81, 41, 50, 18, 33]
>>> random.random() # random float from the interval [0.0, 1.0)
0.... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f2bbbed8-9ce3-44a6-ab2b-34187da43085 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,247 | supabase-export-v2 | 382e5ad7f7692dfa | a deep interest in knowing the relative performance of different approaches to the same problem. Python provides a measurement tool that answers those questions immediately.
For example, it may be tempting to use the tuple packing and unpacking feature
instead of the traditional approach to swapping arguments. The :mod... | trusted_official_docs | CPython Docs | a deep interest in knowing the relative performance of different approaches to the same problem. Python provides a measurement tool that answers those questions immediately.
For example, it may be tempting to use the tuple packing and unpacking feature
instead of the traditional approach to swapping arguments. The :mod... | a deep interest in knowing the relative performance of different approaches to the same problem. Python provides a measurement tool that answers those questions immediately.
For example, it may be tempting to use the tuple packing and unpacking feature
instead of the traditional approach to swapping arguments. The :mod... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fd7fcba2-2fd0-42d0-8fb9-8fd21ae968e8 | CPython Docs | file://datasets/cpython/Doc/tutorial/stdlib.rst | unknown | fb1104f9-e853-4f6a-8c9f-85244484e234 | 53,191 | supabase-export-v2 | ed0e3764759c3488 | use the ``import os`` style instead of ``from os import *``. This will keep :func:`os.open` from shadowing the built-in :func:`open` function which operates much differently.
.. index:: pair: built-in function; help | trusted_official_docs | CPython Docs | use the ``import os`` style instead of ``from os import *``. This will keep :func:`os.open` from shadowing the built-in :func:`open` function which operates much differently.
.. index:: pair: built-in function; help | use the ``import os`` style instead of ``from os import *``. This will keep :func:`os.open` from shadowing the built-in :func:`open` function which operates much differently.
.. index:: pair: built-in function; help | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
13ab43ec-cdeb-4698-a059-2c49afd67704 | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,301 | supabase-export-v2 | 8974458958ec2213 | characters properly, your editor must recognize that the file is UTF-8, and it must use a font that supports all the characters in the file.
To declare an encoding other than the default one, a special comment line
should be added as the *first* line of the file. The syntax is as follows:: | trusted_official_docs | CPython Docs | characters properly, your editor must recognize that the file is UTF-8, and it must use a font that supports all the characters in the file.
To declare an encoding other than the default one, a special comment line
should be added as the *first* line of the file. The syntax is as follows:: | characters properly, your editor must recognize that the file is UTF-8, and it must use a font that supports all the characters in the file.
To declare an encoding other than the default one, a special comment line
should be added as the *first* line of the file. The syntax is as follows:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
18270eac-03a5-4c5e-99c7-1a4cf1be7639 | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,307 | supabase-export-v2 | eb07ad214aa85d89 | starts with a :ref:`UNIX "shebang" line <tut-scripts>`. In this case, the encoding declaration should be added as the second line of the file. For example::
#!/usr/bin/env python3
# -*- coding: cp1252 -*- | trusted_official_docs | CPython Docs | starts with a :ref:`UNIX "shebang" line <tut-scripts>`. In this case, the encoding declaration should be added as the second line of the file. For example::
#!/usr/bin/env python3
# -*- coding: cp1252 -*- | starts with a :ref:`UNIX "shebang" line <tut-scripts>`. In this case, the encoding declaration should be added as the second line of the file. For example::
#!/usr/bin/env python3
# -*- coding: cp1252 -*- | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1edda8f3-0181-4579-b3ef-eaf2afe1bc67 | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,294 | supabase-export-v2 | 9bca026e7b1dd4d5 | Continuation lines are needed when entering a multi-line construct. As an example, take a look at this :keyword:`if` statement::
>>> the_world_is_flat = True
>>> if the_world_is_flat:
... print("Be careful not to fall off!")
... Be careful not to fall off! | trusted_official_docs | CPython Docs | Continuation lines are needed when entering a multi-line construct. As an example, take a look at this :keyword:`if` statement::
>>> the_world_is_flat = True
>>> if the_world_is_flat:
... print("Be careful not to fall off!")
... Be careful not to fall off! | Continuation lines are needed when entering a multi-line construct. As an example, take a look at this :keyword:`if` statement::
>>> the_world_is_flat = True
>>> if the_world_is_flat:
... print("Be careful not to fall off!")
... Be careful not to fall off! | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
238851d7-f8c9-4da5-9704-71b121c92ca1 | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,273 | supabase-export-v2 | bf0e6cc2f2545036 | Invoking the Interpreter ========================
The Python interpreter is usually installed as |usr_local_bin_python_x_dot_y_literal|
on those machines where it is available; putting :file:`/usr/local/bin` in your
Unix shell's search path makes it possible to start it by typing the command: | trusted_official_docs | CPython Docs | Invoking the Interpreter ========================
The Python interpreter is usually installed as |usr_local_bin_python_x_dot_y_literal|
on those machines where it is available; putting :file:`/usr/local/bin` in your
Unix shell's search path makes it possible to start it by typing the command: | Invoking the Interpreter ========================
The Python interpreter is usually installed as |usr_local_bin_python_x_dot_y_literal|
on those machines where it is available; putting :file:`/usr/local/bin` in your
Unix shell's search path makes it possible to start it by typing the command: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
341b5f08-afaa-4305-a278-df07f87706d8 | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,275 | supabase-export-v2 | e9b83d7581e947ef | python3.15
to the shell. [#]_ Since the choice of the directory where the interpreter lives
is an installation option, other places are possible; check with your local
Python guru or system administrator. (E.g., :file:`/usr/local/python` is a
popular alternative location.) | trusted_official_docs | CPython Docs | python3.15
to the shell. [#]_ Since the choice of the directory where the interpreter lives
is an installation option, other places are possible; check with your local
Python guru or system administrator. (E.g., :file:`/usr/local/python` is a
popular alternative location.) | python3.15
to the shell. [#]_ Since the choice of the directory where the interpreter lives
is an installation option, other places are possible; check with your local
Python guru or system administrator. (E.g., :file:`/usr/local/python` is a
popular alternative location.) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
45adc6a8-6357-47b9-beba-be1ad74553e4 | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,286 | supabase-export-v2 | fd1be81d8030f75e | Argument Passing ----------------
When known to the interpreter, the script name and additional arguments
thereafter are turned into a list of strings and assigned to the ``argv``
variable in the ``sys`` module. You can access this list by executing ``import
sys``. The length of the list is at least one; when no script... | trusted_official_docs | CPython Docs | Argument Passing ----------------
When known to the interpreter, the script name and additional arguments
thereafter are turned into a list of strings and assigned to the ``argv``
variable in the ``sys`` module. You can access this list by executing ``import
sys``. The length of the list is at least one; when no script... | Argument Passing ----------------
When known to the interpreter, the script name and additional arguments
thereafter are turned into a list of strings and assigned to the ``argv``
variable in the ``sys`` module. You can access this list by executing ``import
sys``. The length of the list is at least one; when no script... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
588b9fdb-b853-4877-b631-2b5784189abe | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,277 | supabase-export-v2 | f672893a36fb2cd2 | will be available. If you have the :ref:`py.exe launcher <launcher>` installed, you can use the :file:`py` command. See :ref:`setting-envvars` for other ways to launch Python.
Typing an end-of-file character (:kbd:`Control-D` on Unix, :kbd:`Control-Z` on
Windows) at the primary prompt causes the interpreter to exit wit... | trusted_official_docs | CPython Docs | will be available. If you have the :ref:`py.exe launcher <launcher>` installed, you can use the :file:`py` command. See :ref:`setting-envvars` for other ways to launch Python.
Typing an end-of-file character (:kbd:`Control-D` on Unix, :kbd:`Control-Z` on
Windows) at the primary prompt causes the interpreter to exit wit... | will be available. If you have the :ref:`py.exe launcher <launcher>` installed, you can use the :file:`py` command. See :ref:`setting-envvars` for other ways to launch Python.
Typing an end-of-file character (:kbd:`Control-D` on Unix, :kbd:`Control-Z` on
Windows) at the primary prompt causes the interpreter to exit wit... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
652b6dac-27b8-4ec1-9461-b3bb7eb42a01 | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,306 | supabase-export-v2 | d01af46e408dbf8d | # -*- coding: cp1252 -*-
One exception to the *first line* rule is when the source code starts with a
:ref:`UNIX "shebang" line <tut-scripts>`. In this case, the encoding
declaration should be added as the second line of the file. For example:: | trusted_official_docs | CPython Docs | # -*- coding: cp1252 -*-
One exception to the *first line* rule is when the source code starts with a
:ref:`UNIX "shebang" line <tut-scripts>`. In this case, the encoding
declaration should be added as the second line of the file. For example:: | # -*- coding: cp1252 -*-
One exception to the *first line* rule is when the source code starts with a
:ref:`UNIX "shebang" line <tut-scripts>`. In this case, the encoding
declaration should be added as the second line of the file. For example:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7c650fc1-383c-4738-a338-6f195d0bdd5a | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,283 | supabase-export-v2 | dfa7fe72b43b88e4 | is sometimes useful to be able to run the script and enter interactive mode afterwards. This can be done by passing :option:`-i` before the script.
All command line options are described in :ref:`using-on-general`. | trusted_official_docs | CPython Docs | is sometimes useful to be able to run the script and enter interactive mode afterwards. This can be done by passing :option:`-i` before the script.
All command line options are described in :ref:`using-on-general`. | is sometimes useful to be able to run the script and enter interactive mode afterwards. This can be done by passing :option:`-i` before the script.
All command line options are described in :ref:`using-on-general`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
89b6d62f-fa6a-45f8-ae74-32884208bfd4 | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,276 | supabase-export-v2 | ed24de84b02f90d8 | lives is an installation option, other places are possible; check with your local Python guru or system administrator. (E.g., :file:`/usr/local/python` is a popular alternative location.)
On Windows machines where you have installed Python from the :ref:`Microsoft Store
<windows-store>`, the |python_x_dot_y_literal| co... | trusted_official_docs | CPython Docs | lives is an installation option, other places are possible; check with your local Python guru or system administrator. (E.g., :file:`/usr/local/python` is a popular alternative location.)
On Windows machines where you have installed Python from the :ref:`Microsoft Store
<windows-store>`, the |python_x_dot_y_literal| co... | lives is an installation option, other places are possible; check with your local Python guru or system administrator. (E.g., :file:`/usr/local/python` is a popular alternative location.)
On Windows machines where you have installed Python from the :ref:`Microsoft Store
<windows-store>`, the |python_x_dot_y_literal| co... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8b9a8ac0-66fe-450f-8a7c-bf81563845b1 | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,282 | supabase-export-v2 | 0dbe8d3393617b76 | ``python -m module [arg] ...``, which executes the source file for *module* as if you had spelled out its full name on the command line.
When a script file is used, it is sometimes useful to be able to run the script
and enter interactive mode afterwards. This can be done by passing :option:`-i`
before the script. | trusted_official_docs | CPython Docs | ``python -m module [arg] ...``, which executes the source file for *module* as if you had spelled out its full name on the command line.
When a script file is used, it is sometimes useful to be able to run the script
and enter interactive mode afterwards. This can be done by passing :option:`-i`
before the script. | ``python -m module [arg] ...``, which executes the source file for *module* as if you had spelled out its full name on the command line.
When a script file is used, it is sometimes useful to be able to run the script
and enter interactive mode afterwards. This can be done by passing :option:`-i`
before the script. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8fe770a3-d46b-4b92-9223-747fc0df7b26 | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,309 | supabase-export-v2 | a68742fc31596d20 | .. rubric:: Footnotes
.. [#] On Unix, the Python 3.x interpreter is by default not installed with the
executable named ``python``, so that it does not conflict with a
simultaneously installed Python 2.x executable. | trusted_official_docs | CPython Docs | .. rubric:: Footnotes
.. [#] On Unix, the Python 3.x interpreter is by default not installed with the
executable named ``python``, so that it does not conflict with a
simultaneously installed Python 2.x executable. | .. rubric:: Footnotes
.. [#] On Unix, the Python 3.x interpreter is by default not installed with the
executable named ``python``, so that it does not conflict with a
simultaneously installed Python 2.x executable. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ad35e408-5d4e-49c7-a249-ee53a26e84aa | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,279 | supabase-export-v2 | ec0c49a7bc89fd8a | sequence like ``^[[D`` or ``^B`` appears, command line editing isn't available; you'll only be able to use backspace to remove characters from the current line.
The interpreter operates somewhat like the Unix shell: when called with standard
input connected to a tty device, it reads and executes commands interactively;... | trusted_official_docs | CPython Docs | sequence like ``^[[D`` or ``^B`` appears, command line editing isn't available; you'll only be able to use backspace to remove characters from the current line.
The interpreter operates somewhat like the Unix shell: when called with standard
input connected to a tty device, it reads and executes commands interactively;... | sequence like ``^[[D`` or ``^B`` appears, command line editing isn't available; you'll only be able to use backspace to remove characters from the current line.
The interpreter operates somewhat like the Unix shell: when called with standard
input connected to a tty device, it reads and executes commands interactively;... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
af792a52-eb68-41d4-a917-1d855a6f4306 | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,280 | supabase-export-v2 | 742520331c62dd95 | commands interactively; when called with a file name argument or with a file as standard input, it reads and executes a *script* from that file.
A second way of starting the interpreter is ``python -c command [arg] ...``,
which executes the statement(s) in *command*, analogous to the shell's
:option:`-c` option. Since ... | trusted_official_docs | CPython Docs | commands interactively; when called with a file name argument or with a file as standard input, it reads and executes a *script* from that file.
A second way of starting the interpreter is ``python -c command [arg] ...``,
which executes the statement(s) in *command*, analogous to the shell's
:option:`-c` option. Since ... | commands interactively; when called with a file name argument or with a file as standard input, it reads and executes a *script* from that file.
A second way of starting the interpreter is ``python -c command [arg] ...``,
which executes the statement(s) in *command*, analogous to the shell's
:option:`-c` option. Since ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d056b25f-76cd-46d7-9fb2-ee6174397eb1 | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,300 | supabase-export-v2 | f8ef971ad48fd77c | Source Code Encoding --------------------
By default, Python source files are treated as encoded in UTF-8. In that
encoding, characters of most languages in the world can be used simultaneously
in string literals, identifiers and comments --- although the standard library
only uses ASCII characters for identifiers, a c... | trusted_official_docs | CPython Docs | Source Code Encoding --------------------
By default, Python source files are treated as encoded in UTF-8. In that
encoding, characters of most languages in the world can be used simultaneously
in string literals, identifiers and comments --- although the standard library
only uses ASCII characters for identifiers, a c... | Source Code Encoding --------------------
By default, Python source files are treated as encoded in UTF-8. In that
encoding, characters of most languages in the world can be used simultaneously
in string literals, identifiers and comments --- although the standard library
only uses ASCII characters for identifiers, a c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d7027923-0a7e-4e49-aa61-19889817c968 | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,281 | supabase-export-v2 | be893fe6ce81b2b9 | Since Python statements often contain spaces or other characters that are special to the shell, it is usually advised to quote *command* in its entirety.
Some Python modules are also useful as scripts. These can be invoked using
``python -m module [arg] ...``, which executes the source file for *module* as
if you had s... | trusted_official_docs | CPython Docs | Since Python statements often contain spaces or other characters that are special to the shell, it is usually advised to quote *command* in its entirety.
Some Python modules are also useful as scripts. These can be invoked using
``python -m module [arg] ...``, which executes the source file for *module* as
if you had s... | Since Python statements often contain spaces or other characters that are special to the shell, it is usually advised to quote *command* in its entirety.
Some Python modules are also useful as scripts. These can be invoked using
``python -m module [arg] ...``, which executes the source file for *module* as
if you had s... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dc381703-d074-4612-becb-c6c289f0d057 | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,304 | supabase-export-v2 | 40543fee8198400a | where *encoding* is one of the valid :mod:`codecs` supported by Python.
For example, to declare that Windows-1252 encoding is to be used, the first
line of your source code file should be:: | trusted_official_docs | CPython Docs | where *encoding* is one of the valid :mod:`codecs` supported by Python.
For example, to declare that Windows-1252 encoding is to be used, the first
line of your source code file should be:: | where *encoding* is one of the valid :mod:`codecs` supported by Python.
For example, to declare that Windows-1252 encoding is to be used, the first
line of your source code file should be:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dec4e650-9fd0-4177-95fa-110960bcd280 | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,302 | supabase-export-v2 | d60ad25ead06d1aa | encoding other than the default one, a special comment line should be added as the *first* line of the file. The syntax is as follows::
# -*- coding: encoding -*- | trusted_official_docs | CPython Docs | encoding other than the default one, a special comment line should be added as the *first* line of the file. The syntax is as follows::
# -*- coding: encoding -*- | encoding other than the default one, a special comment line should be added as the *first* line of the file. The syntax is as follows::
# -*- coding: encoding -*- | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e2117d8a-da73-4778-92d0-8f28a6e3af72 | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,289 | supabase-export-v2 | 0de2cb29f9f123a1 | Interactive Mode ----------------
When commands are read from a tty, the interpreter is said to be in *interactive
mode*. In this mode it prompts for the next command with the *primary prompt*,
usually three greater-than signs (``>>>``); for continuation lines it prompts
with the *secondary prompt*, by default three do... | trusted_official_docs | CPython Docs | Interactive Mode ----------------
When commands are read from a tty, the interpreter is said to be in *interactive
mode*. In this mode it prompts for the next command with the *primary prompt*,
usually three greater-than signs (``>>>``); for continuation lines it prompts
with the *secondary prompt*, by default three do... | Interactive Mode ----------------
When commands are read from a tty, the interpreter is said to be in *interactive
mode*. In this mode it prompts for the next command with the *primary prompt*,
usually three greater-than signs (``>>>``); for continuation lines it prompts
with the *secondary prompt*, by default three do... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f3f660a6-4a16-4f2f-8dff-da0f3ac46c76 | CPython Docs | file://datasets/cpython/Doc/tutorial/interpreter.rst | unknown | 9ff2b217-d19d-498c-9a7d-2734c3318f09 | 53,278 | supabase-export-v2 | 940a478e51ed99a7 | causes the interpreter to exit with a zero exit status. If that doesn't work, you can exit the interpreter by typing the following command: ``quit()``.
The interpreter's line-editing features include interactive editing, history
substitution and code completion on most systems. Perhaps the quickest check to see whether... | trusted_official_docs | CPython Docs | causes the interpreter to exit with a zero exit status. If that doesn't work, you can exit the interpreter by typing the following command: ``quit()``.
The interpreter's line-editing features include interactive editing, history
substitution and code completion on most systems. Perhaps the quickest check to see whether... | causes the interpreter to exit with a zero exit status. If that doesn't work, you can exit the interpreter by typing the following command: ``quit()``.
The interpreter's line-editing features include interactive editing, history
substitution and code completion on most systems. Perhaps the quickest check to see whether... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
20f6cea6-40ce-4550-82b0-f85f6f2f0b8e | CPython Docs | file://datasets/cpython/Doc/tutorial/appetite.rst | unknown | 2ee68d70-2099-4b5c-92d4-83b2f424f128 | 53,312 | supabase-export-v2 | c027ab0a2ab74c3c | of photo files in a complicated way. Perhaps you'd like to write a small custom database, or a specialized GUI application, or a simple game.
If you're a professional software developer, you may have to work with several
C/C++/Java libraries but find the usual write/compile/test/re-compile cycle is
too slow. Perhaps yo... | trusted_official_docs | CPython Docs | of photo files in a complicated way. Perhaps you'd like to write a small custom database, or a specialized GUI application, or a simple game.
If you're a professional software developer, you may have to work with several
C/C++/Java libraries but find the usual write/compile/test/re-compile cycle is
too slow. Perhaps yo... | of photo files in a complicated way. Perhaps you'd like to write a small custom database, or a specialized GUI application, or a simple game.
If you're a professional software developer, you may have to work with several
C/C++/Java libraries but find the usual write/compile/test/re-compile cycle is
too slow. Perhaps yo... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2257b5cd-4375-48b6-ac68-162b53992c7d | CPython Docs | file://datasets/cpython/Doc/tutorial/appetite.rst | unknown | 2ee68d70-2099-4b5c-92d4-83b2f424f128 | 53,311 | supabase-export-v2 | f00f590c96513fff | ********************** Whetting Your Appetite **********************
If you do much work on computers, eventually you find that there's some task
you'd like to automate. For example, you may wish to perform a
search-and-replace over a large number of text files, or rename and rearrange a
bunch of photo files in a compl... | trusted_official_docs | CPython Docs | ********************** Whetting Your Appetite **********************
If you do much work on computers, eventually you find that there's some task
you'd like to automate. For example, you may wish to perform a
search-and-replace over a large number of text files, or rename and rearrange a
bunch of photo files in a compl... | ********************** Whetting Your Appetite **********************
If you do much work on computers, eventually you find that there's some task
you'd like to automate. For example, you may wish to perform a
search-and-replace over a large number of text files, or rename and rearrange a
bunch of photo files in a compl... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
230775f2-13d4-4b0d-96cd-354d3b27cb07 | CPython Docs | file://datasets/cpython/Doc/tutorial/appetite.rst | unknown | 2ee68d70-2099-4b5c-92d4-83b2f424f128 | 53,325 | supabase-export-v2 | 41e574f88d687945 | Since the best way to learn a language is to use it, the tutorial invites you to play with the Python interpreter as you read.
In the next chapter, the mechanics of using the interpreter are explained. This
is rather mundane information, but essential for trying out the examples shown
later. | trusted_official_docs | CPython Docs | Since the best way to learn a language is to use it, the tutorial invites you to play with the Python interpreter as you read.
In the next chapter, the mechanics of using the interpreter are explained. This
is rather mundane information, but essential for trying out the examples shown
later. | Since the best way to learn a language is to use it, the tutorial invites you to play with the Python interpreter as you read.
In the next chapter, the mechanics of using the interpreter are explained. This
is rather mundane information, but essential for trying out the examples shown
later. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
31983833-5fd6-4afe-b5ad-9ca39e87514f | CPython Docs | file://datasets/cpython/Doc/tutorial/appetite.rst | unknown | 2ee68d70-2099-4b5c-92d4-83b2f424f128 | 53,322 | supabase-export-v2 | 12651c2339ef6646 | * no variable or argument declarations are necessary.
Python is *extensible*: if you know how to program in C it is easy to add a new
built-in function or module to the interpreter, either to perform critical
operations at maximum speed, or to link Python programs to libraries that may
only be available in binary form ... | trusted_official_docs | CPython Docs | * no variable or argument declarations are necessary.
Python is *extensible*: if you know how to program in C it is easy to add a new
built-in function or module to the interpreter, either to perform critical
operations at maximum speed, or to link Python programs to libraries that may
only be available in binary form ... | * no variable or argument declarations are necessary.
Python is *extensible*: if you know how to program in C it is easy to add a new
built-in function or module to the interpreter, either to perform critical
operations at maximum speed, or to link Python programs to libraries that may
only be available in binary form ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4475d42a-352d-4bac-8ebb-0a6c5c6ffbac | CPython Docs | file://datasets/cpython/Doc/tutorial/appetite.rst | unknown | 2ee68d70-2099-4b5c-92d4-83b2f424f128 | 53,316 | supabase-export-v2 | 50e7d1aae6f6a266 | to a much larger problem domain than Awk or even Perl, yet many things are at least as easy in Python as in those languages.
Python allows you to split your program into modules that can be reused in other
Python programs. It comes with a large collection of standard modules that you
can use as the basis of your progra... | trusted_official_docs | CPython Docs | to a much larger problem domain than Awk or even Perl, yet many things are at least as easy in Python as in those languages.
Python allows you to split your program into modules that can be reused in other
Python programs. It comes with a large collection of standard modules that you
can use as the basis of your progra... | to a much larger problem domain than Awk or even Perl, yet many things are at least as easy in Python as in those languages.
Python allows you to split your program into modules that can be reused in other
Python programs. It comes with a large collection of standard modules that you
can use as the basis of your progra... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5f2fc904-5789-4b5a-af00-6fdd78acd7a3 | CPython Docs | file://datasets/cpython/Doc/tutorial/appetite.rst | unknown | 2ee68d70-2099-4b5c-92d4-83b2f424f128 | 53,318 | supabase-export-v2 | 05382a58afc34600 | experiment with features of the language, to write throw-away programs, or to test functions during bottom-up program development. It is also a handy desk calculator.
Python enables programs to be written compactly and readably. Programs written
in Python are typically much shorter than equivalent C, C++, or Java progr... | trusted_official_docs | CPython Docs | experiment with features of the language, to write throw-away programs, or to test functions during bottom-up program development. It is also a handy desk calculator.
Python enables programs to be written compactly and readably. Programs written
in Python are typically much shorter than equivalent C, C++, or Java progr... | experiment with features of the language, to write throw-away programs, or to test functions during bottom-up program development. It is also a handy desk calculator.
Python enables programs to be written compactly and readably. Programs written
in Python are typically much shorter than equivalent C, C++, or Java progr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
772cf128-7cb4-4969-855d-96747c036afe | CPython Docs | file://datasets/cpython/Doc/tutorial/appetite.rst | unknown | 2ee68d70-2099-4b5c-92d4-83b2f424f128 | 53,314 | supabase-export-v2 | ca8f4384eb04a239 | Python is just the language for you.
You could write a Unix shell script or Windows batch files for some of these
tasks, but shell scripts are best at moving around files and changing text data,
not well-suited for GUI applications or games. You could write a C/C++/Java
program, but it can take a lot of development tim... | trusted_official_docs | CPython Docs | Python is just the language for you.
You could write a Unix shell script or Windows batch files for some of these
tasks, but shell scripts are best at moving around files and changing text data,
not well-suited for GUI applications or games. You could write a C/C++/Java
program, but it can take a lot of development tim... | Python is just the language for you.
You could write a Unix shell script or Windows batch files for some of these
tasks, but shell scripts are best at moving around files and changing text data,
not well-suited for GUI applications or games. You could write a C/C++/Java
program, but it can take a lot of development tim... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
797656fc-c135-4eb5-a44e-2d48c18c9c7c | CPython Docs | file://datasets/cpython/Doc/tutorial/appetite.rst | unknown | 2ee68d70-2099-4b5c-92d4-83b2f424f128 | 53,326 | supabase-export-v2 | fe24987415b0b122 | the next chapter, the mechanics of using the interpreter are explained. This is rather mundane information, but essential for trying out the examples shown later.
The rest of the tutorial introduces various features of the Python language and
system through examples, beginning with simple expressions, statements and da... | trusted_official_docs | CPython Docs | the next chapter, the mechanics of using the interpreter are explained. This is rather mundane information, but essential for trying out the examples shown later.
The rest of the tutorial introduces various features of the Python language and
system through examples, beginning with simple expressions, statements and da... | the next chapter, the mechanics of using the interpreter are explained. This is rather mundane information, but essential for trying out the examples shown later.
The rest of the tutorial introduces various features of the Python language and
system through examples, beginning with simple expressions, statements and da... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
84ec71e7-d06a-4735-beb8-dbedce371d58 | CPython Docs | file://datasets/cpython/Doc/tutorial/appetite.rst | unknown | 2ee68d70-2099-4b5c-92d4-83b2f424f128 | 53,324 | supabase-export-v2 | b8114b795df29b74 | Python's Flying Circus" and has nothing to do with reptiles. Making references to Monty Python skits in documentation is not only allowed, it is encouraged!
Now that you are all excited about Python, you'll want to examine it in some
more detail. Since the best way to learn a language is to use it, the tutorial
invites... | trusted_official_docs | CPython Docs | Python's Flying Circus" and has nothing to do with reptiles. Making references to Monty Python skits in documentation is not only allowed, it is encouraged!
Now that you are all excited about Python, you'll want to examine it in some
more detail. Since the best way to learn a language is to use it, the tutorial
invites... | Python's Flying Circus" and has nothing to do with reptiles. Making references to Monty Python skits in documentation is not only allowed, it is encouraged!
Now that you are all excited about Python, you'll want to examine it in some
more detail. Since the best way to learn a language is to use it, the tutorial
invites... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
88aa19d1-a9fd-421f-86cf-5952722bc433 | CPython Docs | file://datasets/cpython/Doc/tutorial/appetite.rst | unknown | 2ee68d70-2099-4b5c-92d4-83b2f424f128 | 53,317 | supabase-export-v2 | 1a1dafa1a4eb7a82 | program in Python. Some of these modules provide things like file I/O, system calls, sockets, and even interfaces to graphical user interface toolkits like Tk.
Python is an interpreted language, which can save you considerable time during
program development because no compilation and linking is necessary. The
interpre... | trusted_official_docs | CPython Docs | program in Python. Some of these modules provide things like file I/O, system calls, sockets, and even interfaces to graphical user interface toolkits like Tk.
Python is an interpreted language, which can save you considerable time during
program development because no compilation and linking is necessary. The
interpre... | program in Python. Some of these modules provide things like file I/O, system calls, sockets, and even interfaces to graphical user interface toolkits like Tk.
Python is an interpreted language, which can save you considerable time during
program development because no compilation and linking is necessary. The
interpre... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a98c0baf-5749-4dcd-a095-06b93d2fe136 | CPython Docs | file://datasets/cpython/Doc/tutorial/appetite.rst | unknown | 2ee68d70-2099-4b5c-92d4-83b2f424f128 | 53,315 | supabase-export-v2 | 7c1d041d5ab06031 | first-draft program. Python is simpler to use, available on Windows, macOS, and Unix operating systems, and will help you get the job done more quickly.
Python is simple to use, but it is a real programming language, offering much
more structure and support for large programs than shell scripts or batch files
can offer... | trusted_official_docs | CPython Docs | first-draft program. Python is simpler to use, available on Windows, macOS, and Unix operating systems, and will help you get the job done more quickly.
Python is simple to use, but it is a real programming language, offering much
more structure and support for large programs than shell scripts or batch files
can offer... | first-draft program. Python is simpler to use, available on Windows, macOS, and Unix operating systems, and will help you get the job done more quickly.
Python is simple to use, but it is a real programming language, offering much
more structure and support for large programs than shell scripts or batch files
can offer... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b6333678-7b1b-4968-8163-6245b6ff263d | CPython Docs | file://datasets/cpython/Doc/tutorial/appetite.rst | unknown | 2ee68d70-2099-4b5c-92d4-83b2f424f128 | 53,313 | supabase-export-v2 | 72baf9d48787f0f3 | you've written a program that could use an extension language, and you don't want to design and implement a whole new language for your application.
Python is just the language for you. | trusted_official_docs | CPython Docs | you've written a program that could use an extension language, and you don't want to design and implement a whole new language for your application.
Python is just the language for you. | you've written a program that could use an extension language, and you don't want to design and implement a whole new language for your application.
Python is just the language for you. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c69dbe0b-1358-4a0b-a7fd-d0f0385c4ca3 | CPython Docs | file://datasets/cpython/Doc/tutorial/appetite.rst | unknown | 2ee68d70-2099-4b5c-92d4-83b2f424f128 | 53,323 | supabase-export-v2 | 20c63d6a3b9c4873 | hooked, you can link the Python interpreter into an application written in C and use it as an extension or command language for that application.
By the way, the language is named after the BBC show "Monty Python's Flying
Circus" and has nothing to do with reptiles. Making references to Monty
Python skits in documentat... | trusted_official_docs | CPython Docs | hooked, you can link the Python interpreter into an application written in C and use it as an extension or command language for that application.
By the way, the language is named after the BBC show "Monty Python's Flying
Circus" and has nothing to do with reptiles. Making references to Monty
Python skits in documentat... | hooked, you can link the Python interpreter into an application written in C and use it as an extension or command language for that application.
By the way, the language is named after the BBC show "Monty Python's Flying
Circus" and has nothing to do with reptiles. Making references to Monty
Python skits in documentat... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d3e00a4b-7eaa-4343-b7e8-498de30c7af5 | CPython Docs | file://datasets/cpython/Doc/tutorial/appetite.rst | unknown | 2ee68d70-2099-4b5c-92d4-83b2f424f128 | 53,319 | supabase-export-v2 | 19de621f7aff9af6 | programs to be written compactly and readably. Programs written in Python are typically much shorter than equivalent C, C++, or Java programs, for several reasons:
* the high-level data types allow you to express complex operations in a single
statement; | trusted_official_docs | CPython Docs | programs to be written compactly and readably. Programs written in Python are typically much shorter than equivalent C, C++, or Java programs, for several reasons:
* the high-level data types allow you to express complex operations in a single
statement; | programs to be written compactly and readably. Programs written in Python are typically much shorter than equivalent C, C++, or Java programs, for several reasons:
* the high-level data types allow you to express complex operations in a single
statement; | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
02974b5c-24c8-44ac-a0c6-684c089466c0 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,468 | supabase-export-v2 | f4816adb09224241 | 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
In a function call, keyword arguments must follow positional arguments. All the keyword arguments passed must match ... | trusted_official_docs | CPython Docs | 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
In a function call, keyword arguments must follow positional arguments. All the keyword arguments passed must match ... | 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
In a function call, keyword arguments must follow positional arguments. All the keyword arguments passed must match ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
072272b4-2ef3-43ed-8a83-0255b8a215bd | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,351 | supabase-export-v2 | cdb1cb73708e7557 | It is possible to let the range start at another number, or to specify a different increment (even negative; sometimes this is called the 'step')::
>>> list(range(5, 10))
[5, 6, 7, 8, 9] | trusted_official_docs | CPython Docs | It is possible to let the range start at another number, or to specify a different increment (even negative; sometimes this is called the 'step')::
>>> list(range(5, 10))
[5, 6, 7, 8, 9] | It is possible to let the range start at another number, or to specify a different increment (even negative; sometimes this is called the 'step')::
>>> list(range(5, 10))
[5, 6, 7, 8, 9] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
09ec719c-11b6-4832-aff5-f870b8efe416 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,386 | supabase-export-v2 | cfa11669001f592c | >>> class MyEmptyClass: ... pass ...
Another place :keyword:`pass` can be used is as a place-holder for a function 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:: | trusted_official_docs | CPython Docs | >>> class MyEmptyClass: ... pass ...
Another place :keyword:`pass` can be used is as a place-holder for a function 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:: | >>> class MyEmptyClass: ... pass ...
Another place :keyword:`pass` can be used is as a place-holder for a function 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:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0dab3714-7956-4944-828d-3bfcdcc6d297 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,393 | supabase-export-v2 | 41c7ac0973a1ca06 | The simplest form compares a subject value against one or more literals::
def http_error(status):
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" | trusted_official_docs | CPython Docs | The simplest form compares a subject value against one or more literals::
def http_error(status):
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" | The simplest form compares a subject value against one or more literals::
def http_error(status):
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" | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0e01ddf4-3eae-4d66-b61c-6a23c0833ace | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,530 | supabase-export-v2 | e8b8f07917ba1e39 | arguments. If they are not available separately, write the function call with the ``*``\ -operator to unpack the arguments out of a list or tuple::
>>> list(range(3, 6)) # normal call with separate arguments
[3, 4, 5]
>>> args = [3, 6]
>>> list(range(*args)) # call with arguments unpacked from a list
[3, 4, 5] | trusted_official_docs | CPython Docs | arguments. If they are not available separately, write the function call with the ``*``\ -operator to unpack the arguments out of a list or tuple::
>>> list(range(3, 6)) # normal call with separate arguments
[3, 4, 5]
>>> args = [3, 6]
>>> list(range(*args)) # call with arguments unpacked from a list
[3, 4, 5] | arguments. If they are not available separately, write the function call with the ``*``\ -operator to unpack the arguments out of a list or tuple::
>>> list(range(3, 6)) # normal call with separate arguments
[3, 4, 5]
>>> args = [3, 6]
>>> list(range(*args)) # call with arguments unpacked from a list
[3, 4, 5] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0e51f691-0082-4fa6-ac30-9b19b0477b85 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,510 | supabase-export-v2 | 26249abd5f8e20fc | def foo(name, **kwds): return 'name' in kwds
There is no possible call that will make it return ``True`` as the keyword ``'name'``
will always bind to the first parameter. For example:: | trusted_official_docs | CPython Docs | def foo(name, **kwds): return 'name' in kwds
There is no possible call that will make it return ``True`` as the keyword ``'name'``
will always bind to the first parameter. For example:: | def foo(name, **kwds): return 'name' in kwds
There is no possible call that will make it return ``True`` as the keyword ``'name'``
will always bind to the first parameter. For example:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
10f2d58b-e2cc-4931-a469-8b49675a3cc3 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,546 | supabase-export-v2 | f55c03d641756fdb | summary from the rest of the description. The following lines should be one or more paragraphs describing the object's calling conventions, its side effects, etc.
The Python parser strips indentation from multi-line string literals when they
serve as module, class, or function docstrings. | trusted_official_docs | CPython Docs | summary from the rest of the description. The following lines should be one or more paragraphs describing the object's calling conventions, its side effects, etc.
The Python parser strips indentation from multi-line string literals when they
serve as module, class, or function docstrings. | summary from the rest of the description. The following lines should be one or more paragraphs describing the object's calling conventions, its side effects, etc.
The Python parser strips indentation from multi-line string literals when they
serve as module, class, or function docstrings. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
12a9f944-e848-474c-ba9c-8c072c2d176d | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,459 | supabase-export-v2 | a936b4c1d906d9ee | If you don't want the default to be shared between subsequent calls, you can write the function like this instead::
def f(a, L=None):
if L is None:
L = []
L.append(a)
return L | trusted_official_docs | CPython Docs | If you don't want the default to be shared between subsequent calls, you can write the function like this instead::
def f(a, L=None):
if L is None:
L = []
L.append(a)
return L | If you don't want the default to be shared between subsequent calls, you can write the function like this instead::
def f(a, L=None):
if L is None:
L = []
L.append(a)
return L | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
12d3dc40-0d6c-424a-a001-0fa6361c2dcc | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,349 | supabase-export-v2 | 62b03fbd5c9a44da | If you do need to iterate over a sequence of numbers, the built-in function :func:`range` comes in handy. It generates arithmetic progressions::
>>> for i in range(5):
... print(i)
... 0
1
2
3
4 | trusted_official_docs | CPython Docs | If you do need to iterate over a sequence of numbers, the built-in function :func:`range` comes in handy. It generates arithmetic progressions::
>>> for i in range(5):
... print(i)
... 0
1
2
3
4 | If you do need to iterate over a sequence of numbers, the built-in function :func:`range` comes in handy. It generates arithmetic progressions::
>>> for i in range(5):
... print(i)
... 0
1
2
3
4 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
13cf4064-2324-4171-994f-8a273438a517 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,439 | supabase-export-v2 | dbc043471556c224 | >>> f100 = fib2(100) # call it >>> f100 # write the result [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
This example, as usual, demonstrates some new Python features: | trusted_official_docs | CPython Docs | >>> f100 = fib2(100) # call it >>> f100 # write the result [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
This example, as usual, demonstrates some new Python features: | >>> f100 = fib2(100) # call it >>> f100 # write the result [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
This example, as usual, demonstrates some new Python features: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
13d5c755-e9c9-4d10-a5d5-da5bf8276967 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,531 | supabase-export-v2 | a0047f6f59174712 | call with separate arguments [3, 4, 5] >>> args = [3, 6] >>> list(range(*args)) # call with arguments unpacked from a list [3, 4, 5]
.. index::
single: **; in function calls | trusted_official_docs | CPython Docs | call with separate arguments [3, 4, 5] >>> args = [3, 6] >>> list(range(*args)) # call with arguments unpacked from a list [3, 4, 5]
.. index::
single: **; in function calls | call with separate arguments [3, 4, 5] >>> args = [3, 6] >>> list(range(*args)) # call with arguments unpacked from a list [3, 4, 5]
.. index::
single: **; in function calls | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
13f75be6-1272-49fd-9d3c-9be4985adb96 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,405 | supabase-export-v2 | 2c3ef1939130da9d | Point(1, var) Point(1, y=var) Point(x=1, y=var) Point(y=var, x=1)
A recommended way to read patterns is to look at them as an extended form of what you
would put on the left of an assignment, to understand which variables would be set to
what. Only the standalone names (like ``var`` above) are assigned to by a match st... | trusted_official_docs | CPython Docs | Point(1, var) Point(1, y=var) Point(x=1, y=var) Point(y=var, x=1)
A recommended way to read patterns is to look at them as an extended form of what you
would put on the left of an assignment, to understand which variables would be set to
what. Only the standalone names (like ``var`` above) are assigned to by a match st... | Point(1, var) Point(1, y=var) Point(x=1, y=var) Point(y=var, x=1)
A recommended way to read patterns is to look at them as an extended form of what you
would put on the left of an assignment, to understand which variables would be set to
what. Only the standalone names (like ``var`` above) are assigned to by a match st... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
16b6e89b-15cb-43a5-9e31-be2b4f1c4eb8 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,406 | supabase-export-v2 | c28d33ee2b96de6b | ``foo.bar``), attribute names (the ``x=`` and ``y=`` above) or class names (recognized by the "(...)" next to them like ``Point`` above) are never assigned to.
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:: | trusted_official_docs | CPython Docs | ``foo.bar``), attribute names (the ``x=`` and ``y=`` above) or class names (recognized by the "(...)" next to them like ``Point`` above) are never assigned to.
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:: | ``foo.bar``), attribute names (the ``x=`` and ``y=`` above) or class names (recognized by the "(...)" next to them like ``Point`` above) are never assigned to.
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:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
17f65d1a-a826-4f9e-bbde-f8b0272d6b8a | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,360 | supabase-export-v2 | a3271ba576dc2e67 | 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.
We say such an object is :term:`iterable`, that is, suitable as a target for
functions and constructs that expect something from which they can
obtain successive items unti... | trusted_official_docs | CPython Docs | 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.
We say such an object is :term:`iterable`, that is, suitable as a target for
functions and constructs that expect something from which they can
obtain successive items unti... | 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.
We say such an object is :term:`iterable`, that is, suitable as a target for
functions and constructs that expect something from which they can
obtain successive items unti... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
180004a8-56a2-4983-b5fc-384d77c851e8 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,533 | supabase-export-v2 | 2e05702387e843c1 | In the same fashion, dictionaries can deliver keyword arguments with the ``**``\ -operator::
>>> def parrot(voltage, state='a stiff', action='voom'):
... print("-- This parrot wouldn't", action, end=' ')
... print("if you put", voltage, "volts through it.", end=' ')
... print("E's", state, "!")
... >>> d = {"voltag... | trusted_official_docs | CPython Docs | In the same fashion, dictionaries can deliver keyword arguments with the ``**``\ -operator::
>>> def parrot(voltage, state='a stiff', action='voom'):
... print("-- This parrot wouldn't", action, end=' ')
... print("if you put", voltage, "volts through it.", end=' ')
... print("E's", state, "!")
... >>> d = {"voltag... | In the same fashion, dictionaries can deliver keyword arguments with the ``**``\ -operator::
>>> def parrot(voltage, state='a stiff', action='voom'):
... print("-- This parrot wouldn't", action, end=' ')
... print("if you put", voltage, "volts through it.", end=' ')
... print("E's", state, "!")
... >>> d = {"voltag... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
181367ee-48aa-4d67-a67e-262f06d2b38b | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,422 | supabase-export-v2 | bcb38b6ce61e4e07 | color = Color(input("Enter your choice of 'red', 'blue' or 'green': "))
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 :(") | trusted_official_docs | CPython Docs | color = Color(input("Enter your choice of 'red', 'blue' or 'green': "))
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 :(") | color = Color(input("Enter your choice of 'red', 'blue' or 'green': "))
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 :(") | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
185a87b7-c88f-41dc-89ec-2f1a47bc6da1 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,469 | supabase-export-v2 | 19c8f604901d0043 | non-optional arguments (e.g. ``parrot(voltage=1000)`` is valid too). No argument may receive a value more than once. Here's an example that fails due to this restriction::
>>> def function(a):
... pass
... >>> function(0, a=0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: functi... | trusted_official_docs | CPython Docs | non-optional arguments (e.g. ``parrot(voltage=1000)`` is valid too). No argument may receive a value more than once. Here's an example that fails due to this restriction::
>>> def function(a):
... pass
... >>> function(0, a=0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: functi... | non-optional arguments (e.g. ``parrot(voltage=1000)`` is valid too). No argument may receive a value more than once. Here's an example that fails due to this restriction::
>>> def function(a):
... pass
... >>> function(0, a=0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: functi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
18cf6bcb-1375-42ec-8380-a08c6d1d586c | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,435 | supabase-export-v2 | 6b951035c1069ba1 | >>> fib <function fib at 10042ed0> >>> f = fib >>> f(100) 0 1 1 2 3 5 8 13 21 34 55 89
Coming from other languages, you might object that ``fib`` is not a function but
a procedure since it doesn't return a value. In fact, even functions without a
:keyword:`return` statement do return a value, albeit a rather boring one... | trusted_official_docs | CPython Docs | >>> fib <function fib at 10042ed0> >>> f = fib >>> f(100) 0 1 1 2 3 5 8 13 21 34 55 89
Coming from other languages, you might object that ``fib`` is not a function but
a procedure since it doesn't return a value. In fact, even functions without a
:keyword:`return` statement do return a value, albeit a rather boring one... | >>> fib <function fib at 10042ed0> >>> f = fib >>> f(100) 0 1 1 2 3 5 8 13 21 34 55 89
Coming from other languages, you might object that ``fib`` is not a function but
a procedure since it doesn't return a value. In fact, even functions without a
:keyword:`return` statement do return a value, albeit a rather boring one... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1a4a1b66-e812-41ca-862d-ddc52b712086 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,419 | supabase-export-v2 | e49e0dcf73404d92 | - Most literals are compared by equality, however the singletons ``True``, ``False`` and ``None`` are compared by identity.
- Patterns may use named constants. These must be dotted names
to prevent them from being interpreted as capture variables:: | trusted_official_docs | CPython Docs | - Most literals are compared by equality, however the singletons ``True``, ``False`` and ``None`` are compared by identity.
- Patterns may use named constants. These must be dotted names
to prevent them from being interpreted as capture variables:: | - Most literals are compared by equality, however the singletons ``True``, ``False`` and ``None`` are compared by identity.
- Patterns may use named constants. These must be dotted names
to prevent them from being interpreted as capture variables:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1cdfc078-92a1-42c0-b375-09a00f6d6fd6 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,524 | supabase-export-v2 | 22d333fde5f1ca3d | These arguments will be wrapped up in a tuple (see :ref:`tut-tuples`). Before the variable number of arguments, zero or more normal arguments may occur. ::
def write_multiple_items(file, separator, *args):
file.write(separator.join(args)) | trusted_official_docs | CPython Docs | These arguments will be wrapped up in a tuple (see :ref:`tut-tuples`). Before the variable number of arguments, zero or more normal arguments may occur. ::
def write_multiple_items(file, separator, *args):
file.write(separator.join(args)) | These arguments will be wrapped up in a tuple (see :ref:`tut-tuples`). Before the variable number of arguments, zero or more normal arguments may occur. ::
def write_multiple_items(file, separator, *args):
file.write(separator.join(args)) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1eb72e5a-d286-4c11-b43d-210465cdab63 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,367 | supabase-export-v2 | f4299574d8666731 | * {n//x}") ... break ... 4 equals 2 * 2 6 equals 2 * 3 8 equals 2 * 4 9 equals 3 * 3
The :keyword:`continue` statement continues with the next
iteration of the loop:: | trusted_official_docs | CPython Docs | * {n//x}") ... break ... 4 equals 2 * 2 6 equals 2 * 3 8 equals 2 * 4 9 equals 3 * 3
The :keyword:`continue` statement continues with the next
iteration of the loop:: | * {n//x}") ... break ... 4 equals 2 * 2 6 equals 2 * 3 8 equals 2 * 4 9 equals 3 * 3
The :keyword:`continue` statement continues with the next
iteration of the loop:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1f823691-01c6-40cc-b307-53f4d440f1ac | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,392 | supabase-export-v2 | e06c9a9b6652ffd8 | it can also extract components (sequence elements or object attributes) from the value into variables. If no case matches, none of the branches is executed.
The simplest form compares a subject value against one or more literals:: | trusted_official_docs | CPython Docs | it can also extract components (sequence elements or object attributes) from the value into variables. If no case matches, none of the branches is executed.
The simplest form compares a subject value against one or more literals:: | it can also extract components (sequence elements or object attributes) from the value into variables. If no case matches, none of the branches is executed.
The simplest form compares a subject value against one or more literals:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
22343c41-1ac8-4b3c-9d0f-431d034fa224 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,511 | supabase-export-v2 | 47725beeb41544b7 | There is no possible call that will make it return ``True`` as the keyword ``'name'`` will always bind to the first parameter. For example::
>>> foo(1, **{'name': 2})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: foo() got multiple values for argument 'name'
>>> | trusted_official_docs | CPython Docs | There is no possible call that will make it return ``True`` as the keyword ``'name'`` will always bind to the first parameter. For example::
>>> foo(1, **{'name': 2})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: foo() got multiple values for argument 'name'
>>> | There is no possible call that will make it return ``True`` as the keyword ``'name'`` will always bind to the first parameter. For example::
>>> foo(1, **{'name': 2})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: foo() got multiple values for argument 'name'
>>> | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
26ffa52e-6ba3-41c4-b08d-8c0f72e91b6e | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,571 | supabase-export-v2 | c3fe87fc4bef68b9 | fancy encodings if your code is meant to be used in international environments. Python's default, UTF-8, or even plain ASCII work best in any case.
* Likewise, don't use non-ASCII characters in identifiers if there is only the
slightest chance people speaking a different language will read or maintain
the code. | trusted_official_docs | CPython Docs | fancy encodings if your code is meant to be used in international environments. Python's default, UTF-8, or even plain ASCII work best in any case.
* Likewise, don't use non-ASCII characters in identifiers if there is only the
slightest chance people speaking a different language will read or maintain
the code. | fancy encodings if your code is meant to be used in international environments. Python's default, UTF-8, or even plain ASCII work best in any case.
* Likewise, don't use non-ASCII characters in identifiers if there is only the
slightest chance people speaking a different language will read or maintain
the code. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
28e5e943-a4ab-4ac2-9059-74e9c2fc9fa5 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,573 | supabase-export-v2 | 0793774c9a8bd091 | .. rubric:: Footnotes
.. [#] Actually, *call by object reference* would be a better description,
since if a mutable object is passed, the caller will see any changes the
callee makes to it (items inserted into a list). | trusted_official_docs | CPython Docs | .. rubric:: Footnotes
.. [#] Actually, *call by object reference* would be a better description,
since if a mutable object is passed, the caller will see any changes the
callee makes to it (items inserted into a list). | .. rubric:: Footnotes
.. [#] Actually, *call by object reference* would be a better description,
since if a mutable object is passed, the caller will see any changes the
callee makes to it (items inserted into a list). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
299e4d8f-496c-474d-9f60-b214c944afdd | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,434 | supabase-export-v2 | d7b7a4259c876133 | that name as a user-defined function. Other names can also point to that same function object and can also be used to access the function::
>>> fib
<function fib at 10042ed0>
>>> f = fib
>>> f(100)
0 1 1 2 3 5 8 13 21 34 55 89 | trusted_official_docs | CPython Docs | that name as a user-defined function. Other names can also point to that same function object and can also be used to access the function::
>>> fib
<function fib at 10042ed0>
>>> f = fib
>>> f(100)
0 1 1 2 3 5 8 13 21 34 55 89 | that name as a user-defined function. Other names can also point to that same function object and can also be used to access the function::
>>> fib
<function fib at 10042ed0>
>>> f = fib
>>> f(100)
0 1 1 2 3 5 8 13 21 34 55 89 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2ce820ae-8dc6-4e17-a295-b54f8949a160 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,376 | supabase-export-v2 | c62e236bf418cf70 | This is exemplified in the following :keyword:`!for` loop, which searches for prime numbers::
>>> for n in range(2, 10):
... for x in range(2, n):
... if n % x == 0:
... print(n, 'equals', x, '*', n//x)
... break
... else:
... # loop fell through without finding a factor
... print(n, 'is a prime number')
... 2 ... | trusted_official_docs | CPython Docs | This is exemplified in the following :keyword:`!for` loop, which searches for prime numbers::
>>> for n in range(2, 10):
... for x in range(2, n):
... if n % x == 0:
... print(n, 'equals', x, '*', n//x)
... break
... else:
... # loop fell through without finding a factor
... print(n, 'is a prime number')
... 2 ... | This is exemplified in the following :keyword:`!for` loop, which searches for prime numbers::
>>> for n in range(2, 10):
... for x in range(2, n):
... if n % x == 0:
... print(n, 'equals', x, '*', n//x)
... break
... else:
... # loop fell through without finding a factor
... print(n, 'is a prime number')
... 2 ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2e95c738-3129-4cf4-a583-aa2b3a4af8b7 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,454 | supabase-export-v2 | d93a93aa271fbc95 | will print ``5``.
**Important warning:** The default value is evaluated only once. This makes a
difference when the default is a mutable 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:: | trusted_official_docs | CPython Docs | will print ``5``.
**Important warning:** The default value is evaluated only once. This makes a
difference when the default is a mutable 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:: | will print ``5``.
**Important warning:** The default value is evaluated only once. This makes a
difference when the default is a mutable 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:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2fdfd01c-9529-462b-9a3e-cb42c017c59f | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,545 | supabase-export-v2 | 5303a5e6d2d6155f | if the name happens to be a verb describing a function's operation). This line should begin with a capital letter and end with a period.
If there are more lines in the documentation string, the second line should be
blank, visually separating the summary from the rest of the description. The
following lines should be o... | trusted_official_docs | CPython Docs | if the name happens to be a verb describing a function's operation). This line should begin with a capital letter and end with a period.
If there are more lines in the documentation string, the second line should be
blank, visually separating the summary from the rest of the description. The
following lines should be o... | if the name happens to be a verb describing a function's operation). This line should begin with a capital letter and end with a period.
If there are more lines in the documentation string, the second line should be
blank, visually separating the summary from the rest of the description. The
following lines should be o... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
32324469-385e-44fb-a618-e12ca473f261 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,428 | supabase-export-v2 | e6e878313f3363db | the function we just defined: >>> fib(2000) 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597
.. index::
single: documentation strings
single: docstrings
single: strings, documentation | trusted_official_docs | CPython Docs | the function we just defined: >>> fib(2000) 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597
.. index::
single: documentation strings
single: docstrings
single: strings, documentation | the function we just defined: >>> fib(2000) 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597
.. index::
single: documentation strings
single: docstrings
single: strings, documentation | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
33cb5094-1136-486a-905b-e03d8d6d58de | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,537 | supabase-export-v2 | f96f58e634864395 | expression. Semantically, they are just syntactic sugar for a normal function definition. Like nested function definitions, lambda functions can reference variables from the containing scope::
>>> def make_incrementor(n):
... return lambda x: x + n
... >>> f = make_incrementor(42)
>>> f(0)
42
>>> f(1)
43 | trusted_official_docs | CPython Docs | expression. Semantically, they are just syntactic sugar for a normal function definition. Like nested function definitions, lambda functions can reference variables from the containing scope::
>>> def make_incrementor(n):
... return lambda x: x + n
... >>> f = make_incrementor(42)
>>> f(0)
42
>>> f(1)
43 | expression. Semantically, they are just syntactic sugar for a normal function definition. Like nested function definitions, lambda functions can reference variables from the containing scope::
>>> def make_incrementor(n):
... return lambda x: x + n
... >>> f = make_incrementor(42)
>>> f(0)
42
>>> f(1)
43 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
34b01c6c-4789-4089-b826-a49c6f659fe7 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,487 | supabase-export-v2 | a8a74b42a67c04da | -------------------------- Positional-Only Parameters --------------------------
Looking at this in a bit more detail, it is possible to mark certain parameters
as *positional-only*. If *positional-only*, the parameters' order matters, and
the parameters cannot be passed by keyword. Positional-only parameters are
place... | trusted_official_docs | CPython Docs | -------------------------- Positional-Only Parameters --------------------------
Looking at this in a bit more detail, it is possible to mark certain parameters
as *positional-only*. If *positional-only*, the parameters' order matters, and
the parameters cannot be passed by keyword. Positional-only parameters are
place... | -------------------------- Positional-Only Parameters --------------------------
Looking at this in a bit more detail, it is possible to mark certain parameters
as *positional-only*. If *positional-only*, the parameters' order matters, and
the parameters cannot be passed by keyword. Positional-only parameters are
place... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3505e997-9b90-4c3f-9af0-55fd91b925db | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,519 | supabase-export-v2 | d166c3216c1a8d21 | As guidance:
* Use positional-only if you want the name of the parameters to not be
available to the user. This is useful when parameter names have no real
meaning, if you want to enforce the order of the arguments when the function
is called or if you need to take some positional parameters and arbitrary
keywords.... | trusted_official_docs | CPython Docs | As guidance:
* Use positional-only if you want the name of the parameters to not be
available to the user. This is useful when parameter names have no real
meaning, if you want to enforce the order of the arguments when the function
is called or if you need to take some positional parameters and arbitrary
keywords.... | As guidance:
* Use positional-only if you want the name of the parameters to not be
available to the user. This is useful when parameter names have no real
meaning, if you want to enforce the order of the arguments when the function
is called or if you need to take some positional parameters and arbitrary
keywords.... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
368ae3d2-fce3-4317-ba7f-a7c0ad5ae781 | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,501 | supabase-export-v2 | 92f9f0c4233577cc | The third function ``kwd_only_arg`` only allows keyword arguments as indicated by a ``*`` in the function definition::
>>> kwd_only_arg(3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: kwd_only_arg() takes 0 positional arguments but 1 was given | trusted_official_docs | CPython Docs | The third function ``kwd_only_arg`` only allows keyword arguments as indicated by a ``*`` in the function definition::
>>> kwd_only_arg(3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: kwd_only_arg() takes 0 positional arguments but 1 was given | The third function ``kwd_only_arg`` only allows keyword arguments as indicated by a ``*`` in the function definition::
>>> kwd_only_arg(3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: kwd_only_arg() takes 0 positional arguments but 1 was given | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
36c333b5-5fa3-4dde-bddc-b178d7bc5f6b | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,388 | supabase-export-v2 | 0b61c4c7739e851e | >>> def initlog(*args): ... pass # Remember to implement this! ...
For this last case, many people use the ellipsis literal :code:`...` instead of
:code:`pass`. This use has no special meaning to Python, and is not part of
the language definition (you could use any constant expression here), but
:code:`...` is used con... | trusted_official_docs | CPython Docs | >>> def initlog(*args): ... pass # Remember to implement this! ...
For this last case, many people use the ellipsis literal :code:`...` instead of
:code:`pass`. This use has no special meaning to Python, and is not part of
the language definition (you could use any constant expression here), but
:code:`...` is used con... | >>> def initlog(*args): ... pass # Remember to implement this! ...
For this last case, many people use the ellipsis literal :code:`...` instead of
:code:`pass`. This use has no special meaning to Python, and is not part of
the language definition (you could use any constant expression here), but
:code:`...` is used con... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3758a3b2-5590-4930-b1b8-59349997701e | CPython Docs | file://datasets/cpython/Doc/tutorial/controlflow.rst | unknown | d304f339-96c1-4452-8a50-5478780d9bd7 | 53,332 | supabase-export-v2 | 3ac0504df8f1b91b | Perhaps the most well-known statement type is the :keyword:`if` statement. For example::
>>> x = int(input("Please enter an integer: "))
Please enter an integer: 42
>>> if x < 0:
... x = 0
... print('Negative changed to zero')
... elif x == 0:
... print('Zero')
... elif x == 1:
... print('Single')
... else:
.... | trusted_official_docs | CPython Docs | Perhaps the most well-known statement type is the :keyword:`if` statement. For example::
>>> x = int(input("Please enter an integer: "))
Please enter an integer: 42
>>> if x < 0:
... x = 0
... print('Negative changed to zero')
... elif x == 0:
... print('Zero')
... elif x == 1:
... print('Single')
... else:
.... | Perhaps the most well-known statement type is the :keyword:`if` statement. For example::
>>> x = int(input("Please enter an integer: "))
Please enter an integer: 42
>>> if x < 0:
... x = 0
... print('Negative changed to zero')
... elif x == 0:
... print('Zero')
... elif x == 1:
... print('Single')
... else:
.... | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.