Skip to content

Bare yield's behaviour undocumented #100201

Closed
@pochmann

Description

@pochmann
def g():
    yield

print(next(g()))

That prints None, but the Yield expressions documentation doesn't say so. It only talks about "returning the value of expression_list to the generator’s caller", but doesn't say that None gets returned if the optional expression_list isn't given.

Maybe it's stated in the PEPs referenced at the end, but I think one shouldn't have to look that far. It should be right there in the documentation.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions