diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2014-05-23 04:34:02 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2014-05-23 04:34:02 (GMT) |
commit | cc798377b76050d65e1a3c86b7f026d37bca63af (patch) | |
tree | 4989edbdbc5660505058c7fe0f4b192ca6f35e44 /Doc/tutorial | |
parent | fd613498482fdc71ebda878196b996c00f85c382 (diff) | |
download | cpython-cc798377b76050d65e1a3c86b7f026d37bca63af.zip cpython-cc798377b76050d65e1a3c86b7f026d37bca63af.tar.gz cpython-cc798377b76050d65e1a3c86b7f026d37bca63af.tar.bz2 |
Issue #21545: Add .pop example and tweak comment about pure mutation methods.
Patch prepared by David Harrigan.
Diffstat (limited to 'Doc/tutorial')
-rw-r--r-- | Doc/tutorial/datastructures.rst | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst index 28e6ad7..02ba115 100644 --- a/Doc/tutorial/datastructures.rst +++ b/Doc/tutorial/datastructures.rst @@ -99,6 +99,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 +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: |