Archive

Monthly Archives: May 2014

Another direction is ipython, http://ipython.org, a pimped python shell. python does not use polish notation nor knows the system commands like find or touch. Within ipython, however, you can change that by calling the magic functions %autocall and %rehashx.

In [1]: %autocall
In [2]: type 2
Out[2]: int
In [3]: %rehashx
In [4]: find /var -maxdepth 1 -name log
/var/log
In [5]: l_dirs = !find /var -maxdepth 1 -path "*/l*"
In [6]: l_dirs
Out[6]: ['/var/log', '/var/lib', '/var/local', '/var/lock']

The autocall-mode is possible because the python syntax is ‘non-polish’ in sense that any valid statement of the form a b can also be written as a(b) (besides compound statement that control the execution).

Unfortunately, the autocall mode does not integrate bash completion. When it finds out that the command is going to be a system command it could give the completion list as provided by bash. Instead it comes up with a proper completion list which is rarely usefull.