[Python-Dev] PEP 362: 4th edition

Victor Stinner victor.stinner at gmail.com
Sat Jun 16 01:19:22 CEST 2012


> Right now we have no way to automatically generate signatures for built-in
> functions.  So, as of current trunk, any such signatures would have to be
> built by hand.
>
> If we could somehow produce signature information in C, what then?  Two
> possible approaches suggest themselves:
>
> Pre-generate the signatures and cache them in the __signature__ attribute.

This solution has an impact on memory footpring.

> Add a callback, perhaps named __get_signature__(), which calculates the
> signature and returns it.

This might be decided before the PEP is accepted, because this is a
new attribute not listed in the PEP. Or would it be possible to call a
function when the __signature__ attribute is read?

Victor


More information about the Python-Dev mailing list