[IPython-dev] Using IPyAutocall + 'command namespace' to get rid of aliases and magics

Ville M. Vainio vivainio at gmail.com
Tue May 15 14:14:40 EDT 2007


Here's something I've though of for a while, but never got around to
implementing:

- Create a 'command namespace', a normal namespace (dict) that is used
for name lookup only when looking up commands, i.e. typically when we
are at start of the line.

- Put all aliases, direct system commands and magics there:

{
'cd' : <MagicCd instance at blah blah>,
'cp' : <SysCommandFormarder at 777>,
'mv': <SysCommandFormarder at 777>,
'd' : <IpyAlias('ls -F')>, ...
}

- Invoke them "kind-of" normally via autocall mechanism. They have
access to full input line, enabling 'sys command forwarder' and
magics.

The 'command namespace' would not be shows via %whos, and it's not
available for normal variable use. However, it's available in
beginning-of-line completer.

All of this isn't a lot of code, but would lead to simpler, less
'special cased' and easier to understand IPython codebase without
sacrificing existing usability.

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'



More information about the IPython-dev mailing list