[IPython-user] Parsing issue (maybe).

Fernando Perez Fernando.Perez at colorado.edu
Fri Jan 13 10:08:05 CST 2006

Ville Vainio wrote:
> On 1/13/06, Fernando Perez <Fernando.Perez at colorado.edu> wrote:
>>I'd like to hear if Robert is willing to leave it on for a while, and see how
>>it goes.  Ideally, %autocall should ALWAYS do the right thing, with the only
> Shouldn't we use inspect.getargspec to "do the right thing" in smart
> autocalling?
> Y:\s60]|17> import inspect
> Y:\s60]|18> def f(x,y=10):
>        |..>     pass
> [Y:\s60]|19> inspect.getargspec(f)
>         <19> (['x', 'y'], None, None, (10,))


In [4]: inspect.getargspec(min)
exceptions.TypeError                                 Traceback (most recent 
call last)

/home/fperez/<ipython console>

/usr/lib/python2.3/inspect.py in getargspec(func)
     653         func = func.im_func
     654     if not isfunction(func):
--> 655         raise TypeError('arg is not a Python function')
     656     args, varargs, varkw = getargs(func.func_code)
     657     return args, varargs, varkw, func.func_defaults

TypeError: arg is not a Python function

getargspec fails with extension code, it only works with pure-python functions.



More information about the IPython-user mailing list