[Python-ideas] PEP proposal: unifying function/method classes

Steven D'Aprano steve at pearwood.info
Sun Mar 25 06:53:57 EDT 2018

On Sun, Mar 25, 2018 at 06:52:09PM +1100, Chris Angelico wrote:

> If people are checking "if type(x) is types.FunctionType", they're
> doing it wrong.

That depends on what "it" is that they're doing.

If they want a callable, then they're doing it wrong.

If they want a function regardless of whether it's written in Python or 
C or Cython, then they're doing it wrong.

But if they *specifically* want a Python function, perhaps so they can 
pull it apart in ways you can't do to functions written in other 
languages, then it is fine.


More information about the Python-ideas mailing list