[Python-checkins] cpython (2.7): Issue #21545: Add .pop example and tweak comment about pure mutation methods.
terry.reedy
python-checkins at python.org
Fri May 23 06:35:16 CEST 2014
http://hg.python.org/cpython/rev/6fc09f30b514
changeset: 90793:6fc09f30b514
branch: 2.7
parent: 90790:e6a9beaff8c9
user: Terry Jan Reedy <tjreedy at udel.edu>
date: Fri May 23 00:34:02 2014 -0400
summary:
Issue #21545: Add .pop example and tweak comment about pure mutation methods.
Patch prepared by David Harrigan.
files:
Doc/tutorial/datastructures.rst | 9 +++++++++
Misc/ACKS | 1 +
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst
--- a/Doc/tutorial/datastructures.rst
+++ b/Doc/tutorial/datastructures.rst
@@ -99,6 +99,15 @@
>>> 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:
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -506,6 +506,7 @@
Lynda Hardman
Derek Harland
Jason Harper
+David Harrigan
Brian Harring
Jonathan Hartley
Travis B. Hartwell
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list