This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients docs@python, ncoghlan, terry.reedy
Date 2014-05-20.21:37:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1400621853.89.0.606116768213.issue21545@psf.upfronthosting.co.za>
In-reply-to
Content
The Tutorial section More on Lists
https://docs.python.org/3.4/tutorial/datastructures.html#more-on-lists includes list.pop but ignores it in the example and final comment. I think the examples should be augmented and the comment modified.

1. (simplest) End the example block with

>>> a.pop()
1234.5
>>> a
[-1, 1, 66.25, 333, 333]

2. The comment says "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." [The footnote says "[1] Other languages may return the mutated object, which allows method chaining, such as d->insert("a")->remove("b")->sort();."]

Inserting 'only' before 'modify' makes the statement true even now with .pop added. I think 'the default' should be added before 'None', but that would be optional. I do not think .pop needs to be explicitly mentioned here since the point of the comment is to explain the lack of a printed return value, and .pop does have a printed return value.
History
Date User Action Args
2014-05-20 21:37:34terry.reedysetrecipients: + terry.reedy, ncoghlan, docs@python
2014-05-20 21:37:33terry.reedysetmessageid: <1400621853.89.0.606116768213.issue21545@psf.upfronthosting.co.za>
2014-05-20 21:37:33terry.reedylinkissue21545 messages
2014-05-20 21:37:32terry.reedycreate