Message362246
| Author |
xtreak |
| Recipients |
ilya, xtreak |
| Date |
2020年02月19日.03:46:54 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1582084015.02.0.844775891753.issue39670@roundup.psfhosted.org> |
| In-reply-to |
| Content |
The fixers are supposed to be executed on Python 2 files where apply was a builtin and was shadowed. So from the context of the fixer it tries to make the modification and it cannot distinguish that it's a builtin or user-defined call. In Python 3 the apply function can be defined by the user and 2to3 fixer doesn't make sense to be executed on Python 3 files. filter is another example where the call is transformed into a list comprehension by 2to3 but by the issue it shouldn't be done because filter is a user-defined function though it's a builtin in Python 2.
def filter(func, iterable):
pass
filter(lambda x: x % 2 == 0, range(10))
RefactoringTool: Refactored /tmp/foo.py
--- /tmp/foo.py (original)
+++ /tmp/foo.py (refactored)
@@ -1,4 +1,4 @@
def filter(func, iterable):
pass
-filter(lambda x: x % 2 == 0, range(10))
+[x for x in range(10) if x % 2 == 0] |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2020年02月19日 03:46:55 | xtreak | set | recipients:
+ xtreak, ilya |
| 2020年02月19日 03:46:55 | xtreak | set | messageid: <1582084015.02.0.844775891753.issue39670@roundup.psfhosted.org> |
| 2020年02月19日 03:46:55 | xtreak | link | issue39670 messages |
| 2020年02月19日 03:46:54 | xtreak | create |
|