Anthony Baxter wrote: > On 12/25/06, Michael Foord <[EMAIL PROTECTED]> wrote: >> Hello all, >> >> I'm trying to determine function signatures from IronPython. >> >> In Python I'd use 'inspect.getargspec'. >> >> In IronPython this raises a 'NotImplementedError'. > > 'inspect' is a pure-python module. Where's the NotImplementedError from? >
I thought it was, but when I checked the standard library I failed to see it. Oops. > Hm. A bit of poking around. > > def foo(a,b,*c): pass > > foo.func_code.co_code is unimplemented - inspect does some foul > disassembly of this for anonymous tuple arguments. I doubt that's ever > going to work, but otherwise it's OK. Except for the bugs. > Disassembly - yuck ! So that can never work for IronPython. > In CPython: >>>> def foo(a,b,*c): > ... pass > ... >>>> foo.func_code.co_argcount > 2 > > While in IronPython... >>>> def foo(a,b,*c): > ... pass > ... >>>> foo.func_code.co_argcount > 3 So if this worked and I had all the named arguments I could tell *if* there were some anonymous tuple arguments (varargs or varkwargs), even know their names but not tell the difference between them. It would be great if IronPython could provide an alternative interface for deducing this information. Some platform specific code could then be put in 'inspect.py'. Michael Foord http://www.voidspace.org.uk/python/articles.shtml > _______________________________________________ > users mailing list > [email protected] > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.409 / Virus Database: 268.15.26/601 - Release Date: 24/12/2006 _______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
