Message218857
| 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:34 | terry.reedy | set | recipients:
+ terry.reedy, ncoghlan, docs@python |
| 2014年05月20日 21:37:33 | terry.reedy | set | messageid: <1400621853.89.0.606116768213.issue21545@psf.upfronthosting.co.za> |
| 2014年05月20日 21:37:33 | terry.reedy | link | issue21545 messages |
| 2014年05月20日 21:37:32 | terry.reedy | create |
|