[Python-Dev] IronPython specific code in inspect module

Daniel Diniz ajaksu at gmail.com
Wed May 20 05:18:34 CEST 2009


Dino Viehland wrote:
> What about instead defining __argspec__ for built-in functions/method
> objects and allowing all the implementations to implement it?  We could
> all agree to return:
>
> [
>        (return_type, (arg_types,...)),
>        (return_type, (arg_types,...)),
> ]
>
> Then inspect can check for that attribute and support introspection on
> built-ins.  This would be an easy feature for us to implement and it
> may also be for Jython as well given that we both get the power of our
> platforms reflection capabilities.  Any platform that implements it
> lights up w/o new platform specific code. And maybe this needs to go
> to python-ideas now :)

Curiously, inspect limitations on CPython (can't inspect
functools.partial, has issues with some descriptors and decorators)
got us chatting about PEP 362: Function Signature Object[0] on
#python-dev today.

PEP 362 was also brought up in a recent thread where the executive
summary was 'it just needs someone to guide it through the last
steps'[1], and it would make this kind of introspection nice and
clean[2].

It makes even more sense now we have PEP 3107: Function Annotations[3] in place.

Cheers,
Daniel

[0] http://www.python.org/dev/peps/pep-0362/
[1] http://mail.python.org/pipermail/python-dev/2009-April/088517.html
[2] http://mail.python.org/pipermail/python-dev/2009-April/088597.html
[3] http://www.python.org/dev/peps/pep-3107/#parameters


More information about the Python-Dev mailing list