Skip to content

pasteurize does not refactor "yield from" statements #115

@rspeer

Description

@rspeer

I'm hoping to actually use pasteurize to maintain a py2 branch of a py3 codebase, langcodes.

Right now I change all the py3 syntax to py2 syntax manually in a branch of unmerged git commits, which is a pain. It would be great if pasteurize could automate this.

One issue I've run into: pasteurize doesn't know what to do with the "yield from" syntax. When it appears as a statement on its own, it can be translated straightforwardly, if a bit inefficiently. For example, the syntax

yield from parse_item(lines)

can become:

for _item in parse_item(lines):
    yield _item

It would probably be much harder to translate the expression form, result = yield from parse_item(lines). I can't think of a good way. PEP 380 has a 39-line monstrosity as the translation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions