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

pasteurize does not refactor "yield from" statements #115

Open
rspeer opened this issue Oct 9, 2014 · 0 comments
Open

pasteurize does not refactor "yield from" statements #115

rspeer opened this issue Oct 9, 2014 · 0 comments

Comments

@rspeer
Copy link

rspeer commented Oct 9, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants