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
itertools fixer fails #56822
Comments
The itertools fixer (izip -> zip, among others), fails for the following code: from itertools import izip
print msg % str(bool(symbol_swapped) and list(izip(*swap_dict).next()) or symbols) It gets converted to: print(msg % str(bool(symbol_swapped) and list(next(izip(*swap_dict))) or symbols)) (note how izip is still there) I've worked aroudn this by introducing tmp = izip(...) and using that, but it'd be nice if 2to3 caught it by default. |
A smaller snippet to reproduce:
This gets converted to: next(izip()) It seems to me that the pattern of the itertools fixer doesn't match to izip().something(), and thus this is skipped. |
I see two problems that cause the posted test cases to fail:
I have fixed both of these issues in the attached patch. Full test suite run; no regressions. |
The patch is small and looks clean to me. Can someone take a look with a view to committing please, thanks. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: