This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: zip fixer fails on zip()[:-1]
Type: behavior Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Aaron.Meurer, VPeric, benjamin.peterson, eric.araujo, xtreak
Priority: normal Keywords:

Created on 2011-07-22 22:11 by VPeric, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg140919 - (view) Author: Vlada Peric (VPeric) Date: 2011-07-22 22:11
The zip fixer fails on this code:

zip(B, D)[:-1]

I fixed this by wrapping explicitly with list(), but that creates a duplicate list on Python 2. 

(Like the other fixes I reported, I assume this also applies to 3.3, but I didn't test it so I don't know; adding Eric and Benjamin to nosy, though)
msg221464 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-24 15:01
@Benjamin can you take this on please?
msg338119 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-03-17 08:11
This seems to have been fixed with issue28837 and 93b4b47e3a720171d67f3b608de406aef462835c. Marking this as resolved. Thanks for the report.

➜  cpython git:(master) ✗ cat /tmp/foo.py
zip(B, D)[:-1]
➜  cpython git:(master) ✗ 2to3-3.7 /tmp/foo.py
RefactoringTool: Skipping optional fixer: buffer
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: Refactored /tmp/foo.py
--- /tmp/foo.py	(original)
+++ /tmp/foo.py	(refactored)
@@ -1 +1 @@
-zip(B, D)[:-1]
+list(zip(B, D))[:-1]
RefactoringTool: Files that need to be modified:
RefactoringTool: /tmp/foo.py
History
Date User Action Args
2022-04-11 14:57:20adminsetgithub: 56825
2019-03-17 08:11:30xtreaksetstatus: open -> closed

nosy: + xtreak
messages: + msg338119

resolution: fixed
stage: resolved
2019-03-15 23:43:16BreamoreBoysetnosy: - BreamoreBoy
2014-06-24 15:01:53BreamoreBoysetversions: + Python 3.4, Python 3.5, - Python 3.2
nosy: + BreamoreBoy

messages: + msg221464

type: behavior
2011-07-25 23:06:40Aaron.Meurersetnosy: + Aaron.Meurer
2011-07-22 22:11:40VPericcreate