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

Documentation of itertools.accumulate is confused #64302

Closed
MLModel mannequin opened this issue Jan 1, 2014 · 6 comments
Closed

Documentation of itertools.accumulate is confused #64302

MLModel mannequin opened this issue Jan 1, 2014 · 6 comments
Assignees
Labels
docs Documentation in the Doc dir easy type-feature A feature request or enhancement

Comments

@MLModel
Copy link
Mannequin

MLModel mannequin commented Jan 1, 2014

BPO 20103
Nosy @akuchling, @rhettinger, @terryjreedy, @ezio-melotti, @MLModel
Files
  • accumulate_doc.patch
  • accumulate2.diff: Second (final) revision of the doc patch for accumulate.
  • 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 = 'https://github.com/akuchling'
    closed_at = <Date 2014-04-16.02:30:21.755>
    created_at = <Date 2014-01-01.16:12:00.835>
    labels = ['easy', 'type-feature', 'docs']
    title = 'Documentation of itertools.accumulate is confused'
    updated_at = <Date 2014-04-16.02:30:21.742>
    user = 'https://github.com/MLModel'

    bugs.python.org fields:

    activity = <Date 2014-04-16.02:30:21.742>
    actor = 'akuchling'
    assignee = 'akuchling'
    closed = True
    closed_date = <Date 2014-04-16.02:30:21.755>
    closer = 'akuchling'
    components = ['Documentation']
    creation = <Date 2014-01-01.16:12:00.835>
    creator = 'MLModel'
    dependencies = []
    files = ['34839', '34878']
    hgrepos = []
    issue_num = 20103
    keywords = ['patch', 'easy']
    message_count = 6.0
    messages = ['207135', '207260', '216172', '216321', '216419', '216420']
    nosy_count = 8.0
    nosy_names = ['akuchling', 'rhettinger', 'terry.reedy', 'chrish42', 'ezio.melotti', 'MLModel', 'docs@python', 'python-dev']
    pr_nums = []
    priority = 'low'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue20103'
    versions = ['Python 3.3', 'Python 3.4']

    @MLModel
    Copy link
    Mannequin Author

    MLModel mannequin commented Jan 1, 2014

    The documentation of itertools.accumulate (10.1) starts out with 2 misleading sentences: "Make an iterator that returns accumulated sums. Elements may be any addable type..." It then goes on to show examples of using the func parameter added in 3.3 that are not additions. It should be changed to something like: "Make an iterator that returns accumulated values. Elements may be any type that can be an argument to func. Func defaults to addition, so by default elements can be any addable types, ..." My wording is awkward, but you get the idea. I think this is a significant documentation issue, not just a nit.

    @MLModel MLModel mannequin assigned docspython Jan 1, 2014
    @MLModel MLModel mannequin added the docs Documentation in the Doc dir label Jan 1, 2014
    @terryjreedy
    Copy link
    Member

    Somewhat orthogonal to Mitchell's suggestion, I would change 'returns' to 'yields' and expand 'elements' to 'elements of *iterable*'.

    @ezio-melotti ezio-melotti added easy type-feature A feature request or enhancement labels Jan 4, 2014
    @rhettinger rhettinger assigned rhettinger and unassigned docspython Jan 8, 2014
    @chrish42
    Copy link
    Mannequin

    chrish42 mannequin commented Apr 14, 2014

    The following patch improves (I hope) the documentation of itertools.accumulate. Comments and feedback welcome.

    Terry, I did not implement your suggestion of changing "returns" to "yields", as it would have made things inconsistent with the documentation (and docstrings) of pretty much all the other generators in the itertools module, as they all use this idiom also. If one of the Python documentation experts thinks this change is also a good idea, please just open a new bug report for that and put me in the nosy list, and I'll do the change for all relevant generators in the itertools module.

    @chrish42
    Copy link
    Mannequin

    chrish42 mannequin commented Apr 15, 2014

    Second revision, incorporating comments. Also document the behavior when passed an empty input iterable.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Apr 16, 2014

    New changeset 9e1d2150fff2 by Andrew Kuchling in branch 'default':
    bpo-20103: Rewrite description of itertools.accumulate().
    http://hg.python.org/cpython/rev/9e1d2150fff2

    @akuchling
    Copy link
    Member

    Thanks for your patch!

    @akuchling akuchling assigned akuchling and unassigned rhettinger Apr 16, 2014
    @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 easy type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants