[IPython-user] Parsing issue (maybe).

Fernando Perez Fernando.Perez at colorado.edu
Thu Jan 12 23:58:18 CST 2006


Fernando Perez wrote:
> Robert Kern wrote:
> 
> 
>>>In [8]: foo & bar
>>>------> foo(& bar)
>>>------------------------------------------------------------
>>>   File "<console>", line 1
>>>     foo(& bar)
>>>         ^
>>>SyntaxError: invalid syntax
>>
>>
>>Turn off %autocall. With %autocall on, ipython recognizes the first token as
>>referring to a callable (I presume Function's are callable), and so it tries to
>>transform the command into a function call. Of course, this doesn't work in this
>>case.
>>
>>I usually have %autocall off for this reason.
> 
> 
> Yes.  Still, I'll fix the autocall parser to recognize all the binary 
> operators and keep off this kind of input.  But disabling autocall will do for 
> now.

OK, I've just fixed the autocall code to make it a LOT more robust, I'll 
commit to SVN later tonight.

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 
ambigous case being when an argument-less function is typed at the command 
line.  But now that we have 'smart' mode, even this should be OK.

Let me know how it goes...

f




More information about the IPython-user mailing list