Hi, I would like to get the list of parameters I need to initialize an AST node.
I'm trying to use the `inspect` module, however it seems I can't use it on a built-in (native?) class, or else I misunderstood. I'm using Python 2.7 and tried with Python 3.2. This is working: >>> import inspect >>> class C: ... def __init__(a,b=4): ... self.sum = a + b ... >>> inspect.getargspec(C.__init__) ArgSpec(args=['a', 'b'], varargs=None, keywords=None, defaults=(4,)) This is not working: >>> import inspect >>> import ast >>> inspect.getargspec(ast.If.__init__) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 813, in getargspec raise TypeError('{!r} is not a Python function'.format(func)) TypeError: <slot wrapper '__init__' of '_ast.AST' objects> is not a Python function I am wondering if there is another way to get these parameters automatically? (ie. without compiling myself a dict) Regards, J. Bilcke
-- http://mail.python.org/mailman/listinfo/python-list