[IPython-dev] Magics, aliases now use raw strings!
Fernando.Perez at colorado.edu
Thu Jan 12 12:17:06 CST 2006
Ville Vainio wrote:
> I just committed a patch to SVN which extends the functionality
> previously only apparent in !system escapes - namely, using of raw
> strings and passing \ characters directly to aliases and magics. This
> more closely reflects the experience you get with system commands in
> bash et. al (and especially cmd.exe!).
> Thanks go to Jerry McRae for the (justified) complaints about the
> previous functionality.
Thanks, Ville. I suspect this will matter more to win32 users, who have to
deal with \ path separators.
> I hope some of you have the time to do "svn up" and play with it a
> bit. Multiline magics and aliases don't work, but they never did and
> I'm not sure if they ever should in the first place.
> %cd magic is still broken due to using shlex.split for arg parsing. I
> have some ideas on how to get around it though...
Please be _very_ careful when dealing with that code: we need to be able to
parse a plain string of the kind
%run foo -a val1 --optionb=val2
and we need to construct a valid sys.argv out of that thing, just like the one
the user would get, were he to run
python foo.py -a val1 --optionb=val2
I'm not saying not to make changes there, but simply to be really careful that
you don't break all the possible corner cases with quote characters, escaped
variables and more. It took me quite a few tries to get that code reasonably
right (and I'm still not sure it's 100% correct). Tread lightly :)
More information about the IPython-dev