Author larry
Recipients brett.cannon, larry, ncoghlan, yselivanov
Date 2014-01-19.21:52:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1390168359.82.0.306015564457.issue20308@psf.upfronthosting.co.za>
In-reply-to
Content
Boy was I surprised by this:

>>> class C: pass
... 
>>> import inspect
>>> inspect.signature(C)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/larry/src/python/clinic_c_types_hacking/Lib/inspect.py", line 1557, in signature
    raise ValueError('callable {!r} is not supported by signature'.format(obj))
ValueError: callable <class '__main__.C'> is not supported by signature

Why not?  C is a callable object.  If you can't find a __new__ or an __init__ in the class, its signature should be pretty predictable.

(It returns a signature if you add either a __new__, an __init__, or both.)
History
Date User Action Args
2014-01-19 21:52:39larrysetrecipients: + larry, brett.cannon, ncoghlan, yselivanov
2014-01-19 21:52:39larrysetmessageid: <1390168359.82.0.306015564457.issue20308@psf.upfronthosting.co.za>
2014-01-19 21:52:39larrylinkissue20308 messages
2014-01-19 21:52:39larrycreate