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

Commitdd3fe99

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 parent0ff1611 commitdd3fe99

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎Doc/faq/programming.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ 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()`` thinking it will give you a sorted copy of ``y``,
484+
mistakenly write ``z=y.sort()`` thinking it will give you a sorted copy of ``y``,
485485
you'll instead end up with ``None``, which will likely cause your program to
486486
generate an easily diagnosed error.
487487

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp