Skip to content

Commit 2c8cc2e

Browse files
committed
Deploying to gh-pages from @ c097ff5 🚀
1 parent af3f638 commit 2c8cc2e

File tree

548 files changed

+3864
-3764
lines changed

Some content is hidden

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

548 files changed

+3864
-3764
lines changed

_sources/faq/programming.rst.txt

+2
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ Yes. The coding style required for standard library modules is documented as
113113
Core Language
114114
=============
115115

116+
.. _faq-unboundlocalerror:
117+
116118
Why am I getting an UnboundLocalError when the variable has a value?
117119
--------------------------------------------------------------------
118120

_sources/library/contextvars.rst.txt

+5
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ Manual Context Management
144144
To get a copy of the current context use the
145145
:func:`~contextvars.copy_context` function.
146146

147+
Every thread will have a different top-level :class:`~contextvars.Context`
148+
object. This means that a :class:`ContextVar` object behaves in a similar
149+
fashion to :func:`threading.local()` when values are assigned in different
150+
threads.
151+
147152
Context implements the :class:`collections.abc.Mapping` interface.
148153

149154
.. method:: run(callable, *args, **kwargs)

_sources/library/re.rst.txt

+3-4
Original file line numberDiff line numberDiff line change
@@ -589,10 +589,9 @@ character ``'$'``.
589589

590590
``\w``
591591
For Unicode (str) patterns:
592-
Matches Unicode word characters; this includes most characters
593-
that can be part of a word in any language, as well as numbers and
594-
the underscore. If the :const:`ASCII` flag is used, only
595-
``[a-zA-Z0-9_]`` is matched.
592+
Matches Unicode word characters; this includes alphanumeric characters (as defined by :meth:`str.isalnum`)
593+
as well as the underscore (``_``).
594+
If the :const:`ASCII` flag is used, only ``[a-zA-Z0-9_]`` is matched.
596595

597596
For 8-bit (bytes) patterns:
598597
Matches characters considered alphanumeric in the ASCII character set;

_sources/library/stdtypes.rst.txt

+33-27
Original file line numberDiff line numberDiff line change
@@ -1623,25 +1623,28 @@ expression support in the :mod:`re` module).
16231623

16241624
.. method:: str.encode(encoding="utf-8", errors="strict")
16251625

1626-
Return an encoded version of the string as a bytes object. Default encoding
1627-
is ``'utf-8'``. *errors* may be given to set a different error handling scheme.
1628-
The default for *errors* is ``'strict'``, meaning that encoding errors raise
1629-
a :exc:`UnicodeError`. Other possible
1630-
values are ``'ignore'``, ``'replace'``, ``'xmlcharrefreplace'``,
1631-
``'backslashreplace'`` and any other name registered via
1632-
:func:`codecs.register_error`, see section :ref:`error-handlers`. For a
1633-
list of possible encodings, see section :ref:`standard-encodings`.
1634-
1635-
By default, the *errors* argument is not checked for best performances, but
1636-
only used at the first encoding error. Enable the :ref:`Python Development
1637-
Mode <devmode>`, or use a :ref:`debug build <debug-build>` to check
1638-
*errors*.
1626+
Return the string encoded to :class:`bytes`.
1627+
1628+
*encoding* defaults to ``'utf-8'``;
1629+
see :ref:`standard-encodings` for possible values.
1630+
1631+
*errors* controls how encoding errors are handled.
1632+
If ``'strict'`` (the default), a :exc:`UnicodeError` exception is raised.
1633+
Other possible values are ``'ignore'``,
1634+
``'replace'``, ``'xmlcharrefreplace'``, ``'backslashreplace'`` and any
1635+
other name registered via :func:`codecs.register_error`.
1636+
See :ref:`error-handlers` for details.
1637+
1638+
For performance reasons, the value of *errors* is not checked for validity
1639+
unless an encoding error actually occurs,
1640+
:ref:`devmode` is enabled
1641+
or a :ref:`debug build <debug-build>` is used.
16391642

16401643
.. versionchanged:: 3.1
1641-
Support for keyword arguments added.
1644+
Added support for keyword arguments.
16421645

16431646
.. versionchanged:: 3.9
1644-
The *errors* is now checked in development mode and
1647+
The value of the *errors* argument is now checked in :ref:`devmode` and
16451648
in :ref:`debug mode <debug-build>`.
16461649

16471650

@@ -2755,29 +2758,32 @@ arbitrary binary data.
27552758
.. method:: bytes.decode(encoding="utf-8", errors="strict")
27562759
bytearray.decode(encoding="utf-8", errors="strict")
27572760

2758-
Return a string decoded from the given bytes. Default encoding is
2759-
``'utf-8'``. *errors* may be given to set a different
2760-
error handling scheme. The default for *errors* is ``'strict'``, meaning
2761-
that encoding errors raise a :exc:`UnicodeError`. Other possible values are
2762-
``'ignore'``, ``'replace'`` and any other name registered via
2763-
:func:`codecs.register_error`, see section :ref:`error-handlers`. For a
2764-
list of possible encodings, see section :ref:`standard-encodings`.
2761+
Return the bytes decoded to a :class:`str`.
2762+
2763+
*encoding* defaults to ``'utf-8'``;
2764+
see :ref:`standard-encodings` for possible values.
2765+
2766+
*errors* controls how decoding errors are handled.
2767+
If ``'strict'`` (the default), a :exc:`UnicodeError` exception is raised.
2768+
Other possible values are ``'ignore'``, ``'replace'``,
2769+
and any other name registered via :func:`codecs.register_error`.
2770+
See :ref:`error-handlers` for details.
27652771

2766-
By default, the *errors* argument is not checked for best performances, but
2767-
only used at the first decoding error. Enable the :ref:`Python Development
2768-
Mode <devmode>`, or use a :ref:`debug build <debug-build>` to check *errors*.
2772+
For performance reasons, the value of *errors* is not checked for validity
2773+
unless a decoding error actually occurs,
2774+
:ref:`devmode` is enabled or a :ref:`debug build <debug-build>` is used.
27692775

27702776
.. note::
27712777

27722778
Passing the *encoding* argument to :class:`str` allows decoding any
27732779
:term:`bytes-like object` directly, without needing to make a temporary
2774-
bytes or bytearray object.
2780+
:class:`!bytes` or :class:`!bytearray` object.
27752781

27762782
.. versionchanged:: 3.1
27772783
Added support for keyword arguments.
27782784

27792785
.. versionchanged:: 3.9
2780-
The *errors* is now checked in development mode and
2786+
The value of the *errors* argument is now checked in :ref:`devmode` and
27812787
in :ref:`debug mode <debug-build>`.
27822788

27832789

_sources/library/weakref.rst.txt

+24
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,30 @@ See :ref:`__slots__ documentation <slots>` for details.
172172
application without adding attributes to those objects. This can be especially
173173
useful with objects that override attribute accesses.
174174

175+
Note that when a key with equal value to an existing key (but not equal identity)
176+
is inserted into the dictionary, it replaces the value but does not replace the
177+
existing key. Due to this, when the reference to the original key is deleted, it
178+
also deletes the entry in the dictionary::
179+
180+
>>> class T(str): pass
181+
...
182+
>>> k1, k2 = T(), T()
183+
>>> d = weakref.WeakKeyDictionary()
184+
>>> d[k1] = 1 # d = {k1: 1}
185+
>>> d[k2] = 2 # d = {k1: 2}
186+
>>> del k1 # d = {}
187+
188+
A workaround would be to remove the key prior to reassignment::
189+
190+
>>> class T(str): pass
191+
...
192+
>>> k1, k2 = T(), T()
193+
>>> d = weakref.WeakKeyDictionary()
194+
>>> d[k1] = 1 # d = {k1: 1}
195+
>>> del d[k1]
196+
>>> d[k2] = 2 # d = {k2: 2}
197+
>>> del k1 # d = {k2: 2}
198+
175199
.. versionchanged:: 3.9
176200
Added support for ``|`` and ``|=`` operators, specified in :pep:`584`.
177201

_sources/reference/executionmodel.rst.txt

+2
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ lead to errors when a name is used within a block before it is bound. This rule
128128
is subtle. Python lacks declarations and allows name binding operations to
129129
occur anywhere within a code block. The local variables of a code block can be
130130
determined by scanning the entire text of the block for name binding operations.
131+
See :ref:`the FAQ entry on UnboundLocalError <faq-unboundlocalerror>`
132+
for examples.
131133

132134
If the :keyword:`global` statement occurs within a block, all uses of the names
133135
specified in the statement refer to the bindings of those names in the top-level

about.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ <h3>瀏覽</h3>
284284
<br />
285285
<br />
286286

287-
最後更新於 12月 19, 2022。
287+
最後更新於 12月 23, 2022。
288288
<a href="/bugs.html">Found a bug</a>?
289289
<br />
290290

bugs.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ <h2>說明文件的錯誤<a class="headerlink" href="#documentation-bugs" title=
206206
</section>
207207
<section id="getting-started-contributing-to-python-yourself">
208208
<span id="contributing-to-python"></span><h2>開始讓自己貢獻 Python<a class="headerlink" href="#getting-started-contributing-to-python-yourself" title="本標頭的永久連結"></a></h2>
209-
<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>
209+
<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>
210210
</section>
211211
</section>
212212

@@ -319,7 +319,7 @@ <h3>瀏覽</h3>
319319
<br />
320320
<br />
321321

322-
最後更新於 12月 19, 2022。
322+
最後更新於 12月 23, 2022。
323323
<a href="/bugs.html">Found a bug</a>?
324324
<br />
325325

c-api/abstract.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ <h3>瀏覽</h3>
294294
<br />
295295
<br />
296296

297-
最後更新於 12月 19, 2022。
297+
最後更新於 12月 23, 2022。
298298
<a href="/bugs.html">Found a bug</a>?
299299
<br />
300300

c-api/allocation.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ <h3>瀏覽</h3>
330330
<br />
331331
<br />
332332

333-
最後更新於 12月 19, 2022。
333+
最後更新於 12月 23, 2022。
334334
<a href="/bugs.html">Found a bug</a>?
335335
<br />
336336

c-api/apiabiversion.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ <h3>瀏覽</h3>
342342
<br />
343343
<br />
344344

345-
最後更新於 12月 19, 2022。
345+
最後更新於 12月 23, 2022。
346346
<a href="/bugs.html">Found a bug</a>?
347347
<br />
348348

c-api/arg.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ <h3>瀏覽</h3>
866866
<br />
867867
<br />
868868

869-
最後更新於 12月 19, 2022。
869+
最後更新於 12月 23, 2022。
870870
<a href="/bugs.html">Found a bug</a>?
871871
<br />
872872

c-api/bool.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ <h3>瀏覽</h3>
292292
<br />
293293
<br />
294294

295-
最後更新於 12月 19, 2022。
295+
最後更新於 12月 23, 2022。
296296
<a href="/bugs.html">Found a bug</a>?
297297
<br />
298298

c-api/buffer.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ <h3>瀏覽</h3>
967967
<br />
968968
<br />
969969

970-
最後更新於 12月 19, 2022。
970+
最後更新於 12月 23, 2022。
971971
<a href="/bugs.html">Found a bug</a>?
972972
<br />
973973

c-api/bytearray.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ <h3>瀏覽</h3>
368368
<br />
369369
<br />
370370

371-
最後更新於 12月 19, 2022。
371+
最後更新於 12月 23, 2022。
372372
<a href="/bugs.html">Found a bug</a>?
373373
<br />
374374

c-api/bytes.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ <h3>瀏覽</h3>
484484
<br />
485485
<br />
486486

487-
最後更新於 12月 19, 2022。
487+
最後更新於 12月 23, 2022。
488488
<a href="/bugs.html">Found a bug</a>?
489489
<br />
490490

c-api/call.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ <h3>瀏覽</h3>
609609
<br />
610610
<br />
611611

612-
最後更新於 12月 19, 2022。
612+
最後更新於 12月 23, 2022。
613613
<a href="/bugs.html">Found a bug</a>?
614614
<br />
615615

c-api/capsule.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ <h3>瀏覽</h3>
405405
<br />
406406
<br />
407407

408-
最後更新於 12月 19, 2022。
408+
最後更新於 12月 23, 2022。
409409
<a href="/bugs.html">Found a bug</a>?
410410
<br />
411411

c-api/cell.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ <h3>瀏覽</h3>
319319
<br />
320320
<br />
321321

322-
最後更新於 12月 19, 2022。
322+
最後更新於 12月 23, 2022。
323323
<a href="/bugs.html">Found a bug</a>?
324324
<br />
325325

c-api/code.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ <h3>瀏覽</h3>
386386
<br />
387387
<br />
388388

389-
最後更新於 12月 19, 2022。
389+
最後更新於 12月 23, 2022。
390390
<a href="/bugs.html">Found a bug</a>?
391391
<br />
392392

c-api/codec.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ <h3>瀏覽</h3>
436436
<br />
437437
<br />
438438

439-
最後更新於 12月 19, 2022。
439+
最後更新於 12月 23, 2022。
440440
<a href="/bugs.html">Found a bug</a>?
441441
<br />
442442

c-api/complex.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ <h3>瀏覽</h3>
417417
<br />
418418
<br />
419419

420-
最後更新於 12月 19, 2022。
420+
最後更新於 12月 23, 2022。
421421
<a href="/bugs.html">Found a bug</a>?
422422
<br />
423423

c-api/concrete.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ <h3>瀏覽</h3>
431431
<br />
432432
<br />
433433

434-
最後更新於 12月 19, 2022。
434+
最後更新於 12月 23, 2022。
435435
<a href="/bugs.html">Found a bug</a>?
436436
<br />
437437

c-api/contextvars.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ <h3>瀏覽</h3>
415415
<br />
416416
<br />
417417

418-
最後更新於 12月 19, 2022。
418+
最後更新於 12月 23, 2022。
419419
<a href="/bugs.html">Found a bug</a>?
420420
<br />
421421

c-api/conversion.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ <h3>瀏覽</h3>
370370
<br />
371371
<br />
372372

373-
最後更新於 12月 19, 2022。
373+
最後更新於 12月 23, 2022。
374374
<a href="/bugs.html">Found a bug</a>?
375375
<br />
376376

c-api/coro.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ <h3>瀏覽</h3>
283283
<br />
284284
<br />
285285

286-
最後更新於 12月 19, 2022。
286+
最後更新於 12月 23, 2022。
287287
<a href="/bugs.html">Found a bug</a>?
288288
<br />
289289

c-api/datetime.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ <h3>瀏覽</h3>
576576
<br />
577577
<br />
578578

579-
最後更新於 12月 19, 2022。
579+
最後更新於 12月 23, 2022。
580580
<a href="/bugs.html">Found a bug</a>?
581581
<br />
582582

c-api/descriptor.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ <h3>瀏覽</h3>
298298
<br />
299299
<br />
300300

301-
最後更新於 12月 19, 2022。
301+
最後更新於 12月 23, 2022。
302302
<a href="/bugs.html">Found a bug</a>?
303303
<br />
304304

c-api/dict.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ <h3>瀏覽</h3>
506506
<br />
507507
<br />
508508

509-
最後更新於 12月 19, 2022。
509+
最後更新於 12月 23, 2022。
510510
<a href="/bugs.html">Found a bug</a>?
511511
<br />
512512

c-api/exceptions.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,7 @@ <h3>瀏覽</h3>
15261526
<br />
15271527
<br />
15281528

1529-
最後更新於 12月 19, 2022。
1529+
最後更新於 12月 23, 2022。
15301530
<a href="/bugs.html">Found a bug</a>?
15311531
<br />
15321532

c-api/file.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ <h3>瀏覽</h3>
344344
<br />
345345
<br />
346346

347-
最後更新於 12月 19, 2022。
347+
最後更新於 12月 23, 2022。
348348
<a href="/bugs.html">Found a bug</a>?
349349
<br />
350350

0 commit comments

Comments
 (0)