Skip to content

Commit 5224e28

Browse files
committed
Deploying to gh-pages from @ 9c5d9d8 🚀
1 parent 59037ec commit 5224e28

File tree

530 files changed

+662
-773
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

530 files changed

+662
-773
lines changed

.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 93845551cd222b0a9ba30766af7c01ea
3+
config: 5f794947e626f64921f52723411e5c82
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

_sources/library/csv.rst.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,10 @@ The :mod:`csv` module defines the following classes:
156156

157157
The *fieldnames* parameter is a :term:`sequence`. If *fieldnames* is
158158
omitted, the values in the first row of file *f* will be used as the
159-
fieldnames. Regardless of how the fieldnames are determined, the
160-
dictionary preserves their original ordering.
159+
fieldnames and will be omitted from the results. If
160+
*fieldnames* is provided, they will be used and the first row will be
161+
included in the results. Regardless of how the fieldnames are determined,
162+
the dictionary preserves their original ordering.
161163

162164
If a row has more fields than fieldnames, the remaining data is put in a
163165
list and stored with the fieldname specified by *restkey* (which defaults

_sources/library/itertools.rst.txt

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -818,10 +818,7 @@ and :term:`generators <generator>` which incur interpreter overhead.
818818
return map(function, count(start))
819819

820820
def repeatfunc(func, times=None, *args):
821-
"""Repeat calls to func with specified arguments.
822-
823-
Example: repeatfunc(random.random)
824-
"""
821+
"Repeat calls to func with specified arguments."
825822
if times is None:
826823
return starmap(func, repeat(args))
827824
return starmap(func, repeat(args, times))
@@ -843,10 +840,8 @@ and :term:`generators <generator>` which incur interpreter overhead.
843840
"Advance the iterator n-steps ahead. If n is None, consume entirely."
844841
# Use functions that consume iterators at C speed.
845842
if n is None:
846-
# feed the entire iterator into a zero-length deque
847843
collections.deque(iterator, maxlen=0)
848844
else:
849-
# advance to the empty slice starting at position n
850845
next(islice(iterator, n, n), None)
851846

852847
def nth(iterable, n, default=None):
@@ -865,7 +860,7 @@ and :term:`generators <generator>` which incur interpreter overhead.
865860

866861
def all_equal(iterable, key=None):
867862
"Returns True if all the elements are equal to each other."
868-
# all_equal('4٤໔4৪', key=int) → True
863+
# all_equal('4٤௪౪໔', key=int) → True
869864
return len(take(2, groupby(iterable, key))) <= 1
870865

871866
def unique_justseen(iterable, key=None):
@@ -895,9 +890,9 @@ and :term:`generators <generator>` which incur interpreter overhead.
895890
def sliding_window(iterable, n):
896891
"Collect data into overlapping fixed-length chunks or blocks."
897892
# sliding_window('ABCDEFG', 4) → ABCD BCDE CDEF DEFG
898-
it = iter(iterable)
899-
window = collections.deque(islice(it, n-1), maxlen=n)
900-
for x in it:
893+
iterator = iter(iterable)
894+
window = collections.deque(islice(iterator, n - 1), maxlen=n)
895+
for x in iterator:
901896
window.append(x)
902897
yield tuple(window)
903898

@@ -947,8 +942,8 @@ and :term:`generators <generator>` which incur interpreter overhead.
947942
seq_index = getattr(iterable, 'index', None)
948943
if seq_index is None:
949944
# Path for general iterables
950-
it = islice(iterable, start, stop)
951-
for i, element in enumerate(it, start):
945+
iterator = islice(iterable, start, stop)
946+
for i, element in enumerate(iterator, start):
952947
if element is value or element == value:
953948
yield i
954949
else:
@@ -963,10 +958,7 @@ and :term:`generators <generator>` which incur interpreter overhead.
963958
pass
964959

965960
def iter_except(func, exception, first=None):
966-
""" Call a function repeatedly until an exception is raised.
967-
968-
Converts a call-until-exception interface to an iterator interface.
969-
"""
961+
"Convert a call-until-exception interface to an iterator interface."
970962
# iter_except(d.popitem, KeyError) → non-blocking dictionary iterator
971963
try:
972964
if first is not None:
@@ -1066,14 +1058,10 @@ The following recipes have a more mathematical flavor:
10661058
# sieve(30) → 2 3 5 7 11 13 17 19 23 29
10671059
if n > 2:
10681060
yield 2
1069-
start = 3
10701061
data = bytearray((0, 1)) * (n // 2)
1071-
limit = math.isqrt(n) + 1
1072-
for p in iter_index(data, 1, start, limit):
1073-
yield from iter_index(data, 1, start, p*p)
1062+
for p in iter_index(data, 1, start=3, stop=math.isqrt(n) + 1):
10741063
data[p*p : n : p+p] = bytes(len(range(p*p, n, p+p)))
1075-
start = p*p
1076-
yield from iter_index(data, 1, start)
1064+
yield from iter_index(data, 1, start=3)
10771065

10781066
def factor(n):
10791067
"Prime factors of n."
@@ -1093,8 +1081,8 @@ The following recipes have a more mathematical flavor:
10931081
"Count of natural numbers up to n that are coprime to n."
10941082
# https://mathworld.wolfram.com/TotientFunction.html
10951083
# totient(12) → 4 because len([1, 5, 7, 11]) == 4
1096-
for p in unique_justseen(factor(n)):
1097-
n -= n // p
1084+
for prime in set(factor(n)):
1085+
n -= n // prime
10981086
return n
10991087

11001088

_sources/library/typing.rst.txt

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -842,14 +842,25 @@ using ``[]``.
842842
.. versionadded:: 3.11
843843

844844
.. data:: Never
845+
NoReturn
845846

846-
The `bottom type <https://en.wikipedia.org/wiki/Bottom_type>`_,
847+
:data:`!Never` and :data:`!NoReturn` represent the
848+
`bottom type <https://en.wikipedia.org/wiki/Bottom_type>`_,
847849
a type that has no members.
848850

849-
This can be used to define a function that should never be
850-
called, or a function that never returns::
851+
They can be used to indicate that a function never returns,
852+
such as :func:`sys.exit`::
851853

852-
from typing import Never
854+
from typing import Never # or NoReturn
855+
856+
def stop() -> Never:
857+
raise RuntimeError('no way')
858+
859+
Or to define a function that should never be
860+
called, as there are no valid arguments, such as
861+
:func:`assert_never`::
862+
863+
from typing import Never # or NoReturn
853864

854865
def never_call_me(arg: Never) -> None:
855866
pass
@@ -862,31 +873,18 @@ using ``[]``.
862873
case str():
863874
print("It's a str")
864875
case _:
865-
never_call_me(arg) # OK, arg is of type Never
866-
867-
.. versionadded:: 3.11
868-
869-
On older Python versions, :data:`NoReturn` may be used to express the
870-
same concept. ``Never`` was added to make the intended meaning more explicit.
876+
never_call_me(arg) # OK, arg is of type Never (or NoReturn)
871877

872-
.. data:: NoReturn
878+
:data:`!Never` and :data:`!NoReturn` have the same meaning in the type system
879+
and static type checkers treat both equivalently.
873880

874-
Special type indicating that a function never returns.
875-
876-
For example::
881+
.. versionadded:: 3.6.2
877882

878-
from typing import NoReturn
883+
Added :data:`NoReturn`.
879884

880-
def stop() -> NoReturn:
881-
raise RuntimeError('no way')
882-
883-
``NoReturn`` can also be used as a
884-
`bottom type <https://en.wikipedia.org/wiki/Bottom_type>`_, a type that
885-
has no values. Starting in Python 3.11, the :data:`Never` type should
886-
be used for this concept instead. Type checkers should treat the two
887-
equivalently.
885+
.. versionadded:: 3.11
888886

889-
.. versionadded:: 3.6.2
887+
Added :data:`Never`.
890888

891889
.. data:: Self
892890

about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ <h3>瀏覽</h3>
402402
<a href="https://www.python.org/psf/donations/">Please donate.</a>
403403
<br />
404404
<br />
405-
最後更新於 May 02, 2024 (19:45 UTC)。
405+
最後更新於 May 04, 2024 (09:58 UTC)。
406406

407407
<a href="/bugs.html">Found a bug</a>?
408408

bugs.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ <h2>說明文件的錯誤<a class="headerlink" href="#documentation-bugs" title=
313313
</section>
314314
<section id="getting-started-contributing-to-python-yourself">
315315
<span id="contributing-to-python"></span><h2>開始讓自己貢獻 Python<a class="headerlink" href="#getting-started-contributing-to-python-yourself" title="連結到這個標頭"></a></h2>
316-
<p>除了只是回報您所發現的錯誤之外,同樣也歡迎您提交修正它們的修補程式 (patch)。您可以在 <a class="reference external" href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果您有任何問題,<a class="reference external" href="https://devguide.python.org/">核心導師郵寄清單</a>是一個友善的地方,您可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
316+
<p>除了只是回報您所發現的錯誤之外,同樣也歡迎您提交修正它們的修補程式 (patch)。您可以在 <a class="reference external" href="https://devguide.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果您有任何問題,<a class="reference external" href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">核心導師郵寄清單</a>是一個友善的地方,您可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
317317
</section>
318318
</section>
319319

@@ -441,7 +441,7 @@ <h3>瀏覽</h3>
441441
<a href="https://www.python.org/psf/donations/">Please donate.</a>
442442
<br />
443443
<br />
444-
最後更新於 May 02, 2024 (19:45 UTC)。
444+
最後更新於 May 04, 2024 (09:58 UTC)。
445445

446446
<a href="/bugs.html">Found a bug</a>?
447447

c-api/abstract.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ <h3>瀏覽</h3>
412412
<a href="https://www.python.org/psf/donations/">Please donate.</a>
413413
<br />
414414
<br />
415-
最後更新於 May 02, 2024 (19:45 UTC)。
415+
最後更新於 May 04, 2024 (09:58 UTC)。
416416

417417
<a href="/bugs.html">Found a bug</a>?
418418

c-api/allocation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ <h3>瀏覽</h3>
426426
<a href="https://www.python.org/psf/donations/">Please donate.</a>
427427
<br />
428428
<br />
429-
最後更新於 May 02, 2024 (19:45 UTC)。
429+
最後更新於 May 04, 2024 (09:58 UTC)。
430430

431431
<a href="/bugs.html">Found a bug</a>?
432432

c-api/apiabiversion.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ <h3>瀏覽</h3>
458458
<a href="https://www.python.org/psf/donations/">Please donate.</a>
459459
<br />
460460
<br />
461-
最後更新於 May 02, 2024 (19:45 UTC)。
461+
最後更新於 May 04, 2024 (09:58 UTC)。
462462

463463
<a href="/bugs.html">Found a bug</a>?
464464

c-api/arg.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ <h3>瀏覽</h3>
969969
<a href="https://www.python.org/psf/donations/">Please donate.</a>
970970
<br />
971971
<br />
972-
最後更新於 May 02, 2024 (19:45 UTC)。
972+
最後更新於 May 04, 2024 (09:58 UTC)。
973973

974974
<a href="/bugs.html">Found a bug</a>?
975975

0 commit comments

Comments
 (0)