Author jdemeyer
Recipients jdemeyer, scoder, steven.daprano
Date 2017-04-14.14:42:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1492180976.81.0.269048673882.issue30071@psf.upfronthosting.co.za>
In-reply-to
Content
> If inspect reports something is a duck, it should be an actual duck, not just something that quacks.

The problem is that some Python packages (Sphinx and IPython for example) really need to know whether it quacks. And the only tool they have is inspect.isfunction(), so they use that. It's silly that every single package using inspect.isfunction() should be fixed. Better just fix inspect.isfunction().

>>> from types import SimpleNamespace
>>> x = SimpleNamespace(__code__=1, spam=2)
>>> '__code__' in dir(x)

Of course, you can always break stuff. User code is not supposed to invent new __dunder__ special names.
History
Date User Action Args
2017-04-14 14:42:56jdemeyersetrecipients: + jdemeyer, scoder, steven.daprano
2017-04-14 14:42:56jdemeyersetmessageid: <1492180976.81.0.269048673882.issue30071@psf.upfronthosting.co.za>
2017-04-14 14:42:56jdemeyerlinkissue30071 messages
2017-04-14 14:42:56jdemeyercreate