[Python-Dev] IronPython specific code in inspect module

Dino Viehland dinov at microsoft.com
Wed May 20 04:36:13 CEST 2009


Michael Foord wrote:
> I have IronPython specific versions of several of these functions which
> use .NET reflection and inspect could fallback to if sys.platform ==
> 'cli'. Would it be ok for me to add these to the inspect module?
> Obviously the tests would only run on IronPython... The behaviour for
> CPython would be unaffected.

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 :)


More information about the Python-Dev mailing list