[New-bugs-announce] [issue32046] 2to3 fix for operator.isCallable()
Serhiy Storchaka
report at bugs.python.org
Thu Nov 16 04:09:32 EST 2017
New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:
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.
----------
components: 2to3 (2.x to 3.x conversion tool)
messages: 306346
nosy: benjamin.peterson, levkivskyi, serhiy.storchaka
priority: normal
severity: normal
status: open
title: 2to3 fix for operator.isCallable()
type: enhancement
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32046>
_______________________________________
More information about the New-bugs-announce
mailing list