Skip to content

Commit ec5253b

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 parent 0ff1611 commit ec5253b

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)