[issue27855] 2to3: Wrong code output w/ has_key

Eric N. Vander Weele report at bugs.python.org
Thu Aug 25 00:21:41 EDT 2016


Eric N. Vander Weele added the comment:

I am unable to replicate this issue with '2to3' from Python 2.7.12, Python 3.4.5, nor Python 3.5.2.

Below is what I get with the versions I mentioned above.

---

$ cat test.py
a.has_key(b) and x

$ 2to3 test.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 test.py
--- test.py    	(original)
+++ test.py    	(refactored)
@@ -1 +1 @@
-a.has_key(b) and x
+b in a and x
RefactoringTool: Files that need to be modified:
RefactoringTool: test.py

---

----------
nosy: +ericvw

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue27855>
_______________________________________


More information about the Python-bugs-list mailing list