New submission from Liang Zhang:
This was copied from Chapter 5 Data Structure in Python language tutorial.
The link I was looking for:
https://docs.python.org/2.7/tutorial/datastructures.html
Some thing might be incorrect and need you to update them in
(5.1.4. List Comprehensions)
It should be like this:
--start--
>>> vec = [-4, -2, 0, 2, 4]
>>> # create a new list with the values doubled
>>> [x*2 for x in vec]
[-8, -4, 0, 4, 8]
>>> # filter the list to exclude negative numbers
>>> [x for x in vec if x >= 0]
[0, 2, 4]
>>> # apply a function to all the elements
>>> [abs(x) for x in vec]
[4, 2, 0, 2, 4] >>>>>>>>>>>It should be [0, 2, 4]<<<<<<<<<<<
--end--
--
assignee: docs@python
components: Documentation
messages: 234485
nosy: Liang.Zhang, docs@python
priority: normal
severity: normal
status: open
title: Documentation correction - 5.1.4. List Comprehensions
type: resource usage
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
___
Python tracker
<http://bugs.python.org/issue23299>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com