[IPython-dev] What To Do With a Problem Like 'cd /'?

Dan Milstein danmil at comcast.net
Wed May 23 13:38:40 EDT 2007


I set this up basically as you described below (and added tests for  
it).  A few caveats:

  - We *do* need to check for assignment, at least, before automagic  
expansion, so that the user can do:

  cd = 3

And not have it get eval'd as magic.  (Ditto for cd,de = 2,3)

(the automagic check does look to see if the 'function' is shadowed  
by something in user_ns, but we need to make it possible for the user  
put the thing into the user_ns in the first place).


  - Do you also want to treat aliases similarly?

Meaning: should we allow alias expansion on lines which look like:

   an_alias /

Now that I've got assignment split out from other python ops, that's  
trivial to add, but I haven't done it yet (mostly because I'm a tiny  
bit fuzzy on the whole alias/magic divide).


-Dan

On May 23, 2007, at 12:46 PM, Ville M. Vainio wrote:

> On 5/23/07, Dan Milstein <danmil at comcast.net> wrote:
>
>> This tries to avoid certain bad autocall issues by checking for the
>> following chars as the start of the rest of a line, and it finds one,
>> just handling the line normally:
>>
>> '!=()<>+*/%^&|'
>>
>> Note how '/' is now in there.  When I reorg'd things, I put that
>> check in prefilter.checkPythonChars, which gets called *before*
>> checkAutomagic.  Thus, when you type:
>
> I think we just need to check for automagic before this. The automagic
> can very well "give up" if the "function" is also in user_ns, without
> need for checks like this.
>
> -- 
> Ville M. Vainio - vivainio.googlepages.com
> blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'




More information about the IPython-dev mailing list