[issue39971] Error on documentation - Quick fix.

Diogo Flores report at bugs.python.org
Sun Mar 15 12:39:23 EDT 2020


New submission from Diogo Flores <dxflores at outlook.com>:

Hello,

A code example from the 'functional programming how-to' raises an error.

The simplest fix would be to remove the Ellipsis object from the 'line_list'.

Thank you,
Diogo

Please check below for the commands issued:

# https://docs.python.org/3/howto/functional.html#generator-expressions-and-list-comprehensions

>>> line_list = ['  line 1\n', 'line 2  \n', ...]
>>> 
>>> # Generator expression -- returns iterator
>>> stripped_iter = (line.strip() for line in line_list)
>>> 
>>> # List comprehension -- returns list
>>> stripped_list = [line.strip() for line in line_list]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in <listcomp>
AttributeError: 'ellipsis' object has no attribute 'strip'

----------
assignee: docs at python
components: Documentation
messages: 364247
nosy: docs at python, dxflores
priority: normal
severity: normal
status: open
title: Error on documentation  -  Quick fix.
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39971>
_______________________________________


More information about the Python-bugs-list mailing list