[New-bugs-announce] [issue6475] Documentation > Tutorial > List Comprehensions

Retro report at bugs.python.org
Mon Jul 13 16:57:40 CEST 2009


New submission from Retro <vinetouu at gmail.com>:

There's a mistake in the code snippet:

>>> freshfruit = ['  banana', '  loganberry ', 'passion fruit  ']
>>> [weapon.strip() for weapon in freshfruit]
['banana', 'loganberry', 'passion fruit']


The second line should be:
>>> [fruit.strip() for fruit in freshfruit]
['banana', 'loganberry', 'passion fruit']


The old code snippet had weapons as items which many people didn't like,
so the code snippet was changed into a friendlier version. Please fix
this code snippet so that weapons are not involved here, even though the
code is not broken. Thank you.

----------
assignee: georg.brandl
components: Documentation
messages: 90486
nosy: Retro, georg.brandl
severity: normal
status: open
title: Documentation > Tutorial > List Comprehensions
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6475>
_______________________________________


More information about the New-bugs-announce mailing list