Skip to content

Test generator functions #6

Description

@eallender

Description:
Verify that generator functions (those using yield) work correctly. Consider if they should have a Yields: section instead of or in addition to Returns:.

Test cases:

def generate_numbers(n: int) -> Generator[int, None, None]:
    """
    Should this have Yields or Returns section?
    """
    for i in range(n):
        yield i

Implementation notes:

  • PEP 257 doesn't specifically mention generators
  • Google/NumPy style guides use Yields: section
  • Could detect generator functions and use Yields: instead of Returns:
  • Or keep current behavior (Returns) for simplicity

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions