mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
Issue #21545: Add .pop example and tweak comment about pure mutation methods.
Patch prepared by David Harrigan.
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user