On Sun, Mar 25, 2018 at 9:53 PM, Steven D'Aprano <st...@pearwood.info> wrote: > 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. >
My point was that checking if the type of something *is* some type object, that's the wrong way to do things, and that a proper isinstance check has other ways to solve the underlying problem. ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/