Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5b95c2b

Browse files
Deploy preview for PR 1148 🛫
1 parent63173e3 commit5b95c2b

File tree

571 files changed

+646
-600
lines changed

Some content is hidden

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

571 files changed

+646
-600
lines changed

‎pr-preview/pr-1148/_sources/tutorial/datastructures.rst.txt‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,12 @@ dictionary; this is also the way dictionaries are written on output.
512512
The main operations on a dictionary are storing a value with some key and
513513
extracting the value given the key. It is also possible to delete a key:value
514514
pair with ``del``. If you store using a key that is already in use, the old
515-
value associated with that key is forgotten. It is an error to extract a value
516-
using a non-existent key.
515+
value associated with that key is forgotten.
516+
517+
Extracting a value for a non-existent key by subscripting (``d[key]``) raises a
518+
:exc:`KeyError`. To avoid getting this error when trying to access a possibly
519+
non-existent key, use the:meth:`~dict.get` method instead, which returns
520+
``None`` (or a specified default value) if the key is not in the dictionary.
517521

518522
Performing ``list(d)`` on a dictionary returns a list of all the keys
519523
used in the dictionary, in insertion order (if you want it sorted, just use
@@ -528,6 +532,12 @@ Here is a small example using a dictionary::
528532
{'jack': 4098, 'sape': 4139, 'guido': 4127}
529533
>>> tel['jack']
530534
4098
535+
>>> tel['irv']
536+
Traceback (most recent call last):
537+
File "<stdin>", line 1, in <module>
538+
KeyError: 'irv'
539+
>>> print(tel.get('irv'))
540+
None
531541
>>> del tel['sape']
532542
>>> tel['irv'] = 4127
533543
>>> tel

‎pr-preview/pr-1148/_sources/whatsnew/3.14.rst.txt‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,19 @@ The compiler now emits a :exc:`SyntaxWarning` when a :keyword:`return`,
937937
leaving a:keyword:`finally` block.
938938
This change is specified in:pep:`765`.
939939

940+
In situations where this change is inconvenient (such as those where the
941+
warnings are redundant due to code linting), the:ref:`warning filter
942+
<warning-filter>` can be used to turn off all syntax warnings by adding
943+
``ignore::SyntaxWarning`` as a filter. This can be specified in combination
944+
with a filter that converts other warnings to errors (for example, passing
945+
``-Werror -Wignore::SyntaxWarning`` as CLI options, or setting
946+
``PYTHONWARNINGS=error,ignore::SyntaxWarning``).
947+
948+
Note that applying such a filter at runtime using the:mod:`warnings` module
949+
will only suppress the warning in code that is compiled *after* the filter is
950+
adjusted. Code that is compiled prior to the filter adjustment (for example,
951+
when a module is imported) will still emit the syntax warning.
952+
940953
(Contributed by Irit Katriel in:gh:`130080`.)
941954

942955

‎pr-preview/pr-1148/about.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ <h3>導航</h3>
314314
<ahref="https://www.python.org/psf/donations/">敬請捐贈。</a>
315315
<br>
316316
<br>
317-
最後更新於 10月06, 2025 (00:20 UTC)。
317+
最後更新於 10月07, 2025 (00:21 UTC)。
318318

319319
<ahref="/bugs.html">發現 bug</a>
320320

‎pr-preview/pr-1148/bugs.html‎

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

@@ -352,7 +352,7 @@ <h3>導航</h3>
352352
<ahref="https://www.python.org/psf/donations/">敬請捐贈。</a>
353353
<br>
354354
<br>
355-
最後更新於 10月06, 2025 (00:20 UTC)。
355+
最後更新於 10月07, 2025 (00:21 UTC)。
356356

357357
<ahref="/bugs.html">發現 bug</a>
358358

‎pr-preview/pr-1148/c-api/abstract.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ <h3>導航</h3>
323323
<ahref="https://www.python.org/psf/donations/">敬請捐贈。</a>
324324
<br>
325325
<br>
326-
最後更新於 10月06, 2025 (00:20 UTC)。
326+
最後更新於 10月07, 2025 (00:21 UTC)。
327327

328328
<ahref="/bugs.html">發現 bug</a>
329329

‎pr-preview/pr-1148/c-api/allocation.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ <h3>導航</h3>
432432
<ahref="https://www.python.org/psf/donations/">敬請捐贈。</a>
433433
<br>
434434
<br>
435-
最後更新於 10月06, 2025 (00:20 UTC)。
435+
最後更新於 10月07, 2025 (00:21 UTC)。
436436

437437
<ahref="/bugs.html">發現 bug</a>
438438

‎pr-preview/pr-1148/c-api/apiabiversion.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ <h3>導航</h3>
471471
<ahref="https://www.python.org/psf/donations/">敬請捐贈。</a>
472472
<br>
473473
<br>
474-
最後更新於 10月06, 2025 (00:20 UTC)。
474+
最後更新於 10月07, 2025 (00:21 UTC)。
475475

476476
<ahref="/bugs.html">發現 bug</a>
477477

‎pr-preview/pr-1148/c-api/arg.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ <h3>導航</h3>
954954
<ahref="https://www.python.org/psf/donations/">敬請捐贈。</a>
955955
<br>
956956
<br>
957-
最後更新於 10月06, 2025 (00:20 UTC)。
957+
最後更新於 10月07, 2025 (00:21 UTC)。
958958

959959
<ahref="/bugs.html">發現 bug</a>
960960

‎pr-preview/pr-1148/c-api/bool.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ <h3>導航</h3>
334334
<ahref="https://www.python.org/psf/donations/">敬請捐贈。</a>
335335
<br>
336336
<br>
337-
最後更新於 10月06, 2025 (00:20 UTC)。
337+
最後更新於 10月07, 2025 (00:21 UTC)。
338338

339339
<ahref="/bugs.html">發現 bug</a>
340340

‎pr-preview/pr-1148/c-api/buffer.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ <h3>導航</h3>
10161016
<ahref="https://www.python.org/psf/donations/">敬請捐贈。</a>
10171017
<br>
10181018
<br>
1019-
最後更新於 10月06, 2025 (00:20 UTC)。
1019+
最後更新於 10月07, 2025 (00:21 UTC)。
10201020

10211021
<ahref="/bugs.html">發現 bug</a>
10221022

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp