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

Commit714fb14

Browse files
Clarify how you would end up with None in programming.rst
Assigning `y.sort()` to a variable clarifies why you would end up with a `None`.
1 parent56e337d commit714fb14

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎Doc/faq/programming.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,9 @@ object, whereas superficially similar operations (for example ``y = y + [10]``
481481
and:func:`sorted(y) <sorted>`) create a new object. In general in Python (and in all cases
482482
in the standard library) a method that mutates an object will return ``None``
483483
to help avoid getting the two types of operations confused. So if you
484-
mistakenly write ``y.sort()`` thinkingit will give you a sorted copy of ``y``,
485-
you'll instead end up with ``None``, which will likely cause your program to
486-
generate an easily diagnosed error.
484+
mistakenly write ``z =y.sort()`` thinking``z`` is a sorted copy of ``y``,
485+
you'll instead end up with ``z`` being ``None``, which will likely cause
486+
your program togenerate an easily diagnosed error.
487487

488488
However, there is one class of operations where the same operation sometimes
489489
has different behaviors with different types: the augmented assignment

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp