You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently 2to3 converts operator.isCallable(obj) to hasattr(obj, '__call__'). This looks cumbersome, and can be deceived by instance attribute call. The more correct way is to use isinstance(obj, collections.abc.Callable). Starting from Python 3.2 it can use the callable() builtin.
New changeset a489599 by Éric Araujo (Dong-hee Na) in branch 'master': bpo-32046: Update 2to3 when converts operator.isCallable(obj). (bpo-4417) a489599
We do backport lib2to3 PRs to maintenance branches, but since this is already in 3.7 and 3.6 is four months away from being in security-fix-only mode, I think we can close this as 'fixed' now.
Activity
serhiy-storchaka commentedon Nov 16, 2017
Currently 2to3 converts
operator.isCallable(obj)tohasattr(obj, '__call__'). This looks cumbersome, and can be deceived by instance attribute call. The more correct way is to useisinstance(obj, collections.abc.Callable). Starting from Python 3.2 it can use the callable() builtin.gvanrossum commentedon Nov 17, 2017
I would convert this to
callable()-- the conversion to collections.abc.Callable is more verbose and requires an extra import (that can be slow).merwok commentedon Nov 28, 2017
New changeset a489599 by Éric Araujo (Dong-hee Na) in branch 'master':
bpo-32046: Update 2to3 when converts operator.isCallable(obj). (bpo-4417)
a489599
merwok commentedon Nov 28, 2017
Merged in master, I suppose stable branches should be left alone?
corona10 commentedon Jul 13, 2018
@serhiy.storchaka
If we don't have plans with backporting patches than we can close this issue.
berkerpeksag commentedon Aug 2, 2018
We do backport lib2to3 PRs to maintenance branches, but since this is already in 3.7 and 3.6 is four months away from being in security-fix-only mode, I think we can close this as 'fixed' now.