How do I get the constructor signature for built-in types?

Ian Kelly ian.g.kelly at gmail.com
Tue Jun 5 03:39:51 EDT 2012


On Mon, Jun 4, 2012 at 11:19 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> How do I programmatically get the argument spec of built-in types'
> __init__ or __new__ methods?

I don't think that you can. Methods implemented in C don't really even
have established argument specs.  They just take tuples and dicts and
use the PyArg_Parse* family of functions to unpack them.  So
effectively, all built-in methods have the argspec (self, *args,
**keywords)

Cheers,
Ian



More information about the Python-list mailing list