[IPython-user] Inconsistency in "!!" ?
Krishna Mohan Gundu
gkmohan at gmail.com
Thu Jun 22 18:47:52 CDT 2006
> > For more info see http://projects.scipy.org/ipython/ipython/wiki/UsingIPipe
Thanks for the link Walter. Interesting stuff in there.
> Implementing !/!! so that they would work inside arbitrary statements
> would be very complex, now it's just
I have been making a note to myself as to what I felt are
inconsistencies in regards to the shell behavior. Probably this is the
best place to mention them.
1) var = !command => both outputs and assigns the result. Should there
2) \tab+ $[$]var = command => syntax error.
3) no variable substitution in sout(command_string) and lout(command_string)
4) absence of sout() and lout() in 'sh' profile
Currently it all looks complicated. I suggest the following. Instead
of making the shell command syntax open ended (actually ending in
'\n') we use a token to signify the start and the end of a shell
command. I suggest ``, as it is an illegal python syntax and resembles
shell execute syntax. Something like
[var =] ``[keyword] command``
keyword could be (note that quotes are required to allow
disambiguation from a command name)
"list" - return the output as a list splitting at \n (default)
"string" - return the output as a string
"result" - return the exit status of command
Each of these commands are replaced with, say, _ip.getoutput() or
_ip.getresult() so they can be directly invoked if desired. This can
be done with a prefilter hook. I think this reads much cleaner. What
do you say?
More information about the IPython-user