Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:
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] ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39670> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com