Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Itertools documentation says iterator when iterable is intended #68812

Closed
NeilGirdhar mannequin opened this issue Jul 13, 2015 · 3 comments
Closed

Itertools documentation says iterator when iterable is intended #68812

NeilGirdhar mannequin opened this issue Jul 13, 2015 · 3 comments
Labels
docs Documentation in the Doc dir type-feature A feature request or enhancement

Comments

@NeilGirdhar
Copy link
Mannequin

NeilGirdhar mannequin commented Jul 13, 2015

BPO 24624
Nosy @stevendaprano, @NeilGirdhar

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2015-07-13.03:28:05.205>
created_at = <Date 2015-07-13.01:37:26.222>
labels = ['type-feature', 'invalid', 'docs']
title = 'Itertools documentation says iterator when iterable is intended'
updated_at = <Date 2015-07-13.06:20:01.878>
user = 'https://github.com/NeilGirdhar'

bugs.python.org fields:

activity = <Date 2015-07-13.06:20:01.878>
actor = 'NeilGirdhar'
assignee = 'docs@python'
closed = True
closed_date = <Date 2015-07-13.03:28:05.205>
closer = 'r.david.murray'
components = ['Documentation']
creation = <Date 2015-07-13.01:37:26.222>
creator = 'NeilGirdhar'
dependencies = []
files = []
hgrepos = []
issue_num = 24624
keywords = []
message_count = 3.0
messages = ['246676', '246678', '246683']
nosy_count = 3.0
nosy_names = ['steven.daprano', 'docs@python', 'NeilGirdhar']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue24624'
versions = ['Python 3.5']

@NeilGirdhar
Copy link
Mannequin Author

NeilGirdhar mannequin commented Jul 13, 2015

In the description of the consume recipe:

def consume(iterator, n):
    "Advance the iterator n-steps ahead. If n is none, consume entirely."
    # Use functions that consume iterators at C speed.
    if n is None:
        # feed the entire iterator into a zero-length deque
        collections.deque(iterator, maxlen=0)
    else:
        # advance to the empty slice starting at position n
        next(islice(iterator, n, n), None)

iterator should be replaced with iterable. This function accepts strings for example, which are not iterators.

@NeilGirdhar NeilGirdhar mannequin assigned docspython Jul 13, 2015
@NeilGirdhar NeilGirdhar mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement labels Jul 13, 2015
@stevendaprano
Copy link
Member

On Mon, Jul 13, 2015 at 01:37:26AM +0000, Neil Girdhar wrote:

New submission from Neil Girdhar:

In the description of the consume recipe:
[...]
iterator should be replaced with iterable. This function accepts strings for example, which are not iterators.

It *accepts* strings, but it doesn't consume them. It runs through the
string, but the string still exists and you can iterate over it again
and again and again.

The intent of the recipe is to consume an *iterator* not arbitrary
iterables. I don't believe the recipe or its description needs to be
changed.

@NeilGirdhar
Copy link
Mannequin Author

NeilGirdhar mannequin commented Jul 13, 2015

Ah, good point.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants