Neil Benn wrote: > I'm using the inspect module to get information about the method > arguments back. > > However................... > > My problem is that the getargs methods of inspect want a code object. > Looking through the docs on Python.org I can't work out how to convert a > method call to a code object so that I can then get the arguments back. > > Please could someone advise me, pretty please? Try this: >>> import inspect >>> class Foo: ... def method(self, arg1, arg2="something"): ... pass ... >>> f = Foo() >>> inspect.getargs(f.method.im_func.func_code) (['self', 'arg1', 'arg2'], None, None) -Steve -- Steve Purcell, Pythangelist Get testing at http://pyunit.sourceforge.net/ Any opinions expressed herein are my own and not necessarily those of Yahoo
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4