Issue #21545: Add .pop example and tweak comment about pure mutation methods.

Patch prepared by David Harrigan.
This commit is contained in:
Terry Jan Reedy 2014-05-23 00:34:12 -04:00
parent 7096e26983
commit e17de09101
2 changed files with 8 additions and 2 deletions

View File

@ -111,10 +111,15 @@ An example that uses most of the list methods::
>>> a.sort()
>>> a
[-1, 1, 66.25, 333, 333, 1234.5]
>>> a.pop()
1234.5
>>> a
[-1, 1, 66.25, 333, 333]
You might have noticed that methods like ``insert``, ``remove`` or ``sort`` that
modify the list have no return value printed -- they return ``None``. [1]_ This
is a design principle for all mutable data structures in Python.
only modify the list have no return value printed -- they return the default
``None``. [1]_ This is a design principle for all mutable data structures in
Python.
.. _tut-lists-as-stacks:

View File

@ -507,6 +507,7 @@ Barry Hantman
Lynda Hardman
Derek Harland
Jason Harper
David Harrigan
Brian Harring
Jonathan Hartley
Travis B. Hartwell