Skip to content

Better documentation for Iter::zip behavior #52279

Closed
@Lucretiel

Description

@Lucretiel

In particular, we should specify and document what exactly zip does when its first child terminates. Currently, as soon as self.a.next() returns None, it short-circuits execution without calling self.b.next(). This could lead to some potential surprising behavior:

self.a  1  2  3     5  6
self.b  1  2  3  4  5  6
------
self    11 22 33    54 65

To be clear, I'm not saying this behavior is bad; just that it should be more explicitly documented. This will allow developers to more confidently build abstractions on top of Zip, knowing exactly what it does with the underlying iterator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions