From cc798377b76050d65e1a3c86b7f026d37bca63af Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Fri, 23 May 2014 00:34:02 -0400 Subject: [PATCH] Issue #21545: Add .pop example and tweak comment about pure mutation methods. Patch prepared by David Harrigan. --- Doc/tutorial/datastructures.rst | 9 +++++++++ Misc/ACKS | 1 + 2 files changed, 10 insertions(+) diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst index 28e6ad71b9..02ba11509f 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: diff --git a/Misc/ACKS b/Misc/ACKS index c8c3880797..9ae3341490 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -506,6 +506,7 @@ Barry Hantman Lynda Hardman Derek Harland Jason Harper +David Harrigan Brian Harring Jonathan Hartley Travis B. Hartwell -- 2.50.1