[IPython-user] _ip.magic() instead of ipmagic(); namespaces are a honkin' great idea
Ville Vainio
vivainio at gmail.com
Sat Jan 28 14:21:48 CST 2006
I've now committed a change to trunk/ that should make ipmagic() in
user namespace redundant. The "IPApi" object that exposes IPython
public API (for extensions & configuration) is now available in user
namespace with the name _ip (not to confuse with __IP, use of which is
not recommended).
Here's a sample session:
[~/ipython]|1> cd
[~]|2> !ls /tmp
gconfd-ville keyring-H8iGp7 orbit-ville
hsperfdata_ville mapping-ville ssh-aQkpsB9391
[~]|3> hist
1: _ip.magic("cd ")
2: _ip.system("ls /tmp")
3: _ip.magic("hist ")
[~]|4>
It shouldn't break anything.
Have fun with the new _ip object! Example:
[~]|5> _ip
<5> <IPython.ipapi.IPApi instance at 0x2aaaac2babd8>
[~]|6> _ip.
_ip.IP _ip.__module__ _ip.magic _ip.system
_ip.__class__ _ip.ev _ip.meta _ip.user_ns
_ip.__doc__ _ip.ex _ip.options
_ip.__init__ _ip.expose_magic _ip.set_hook
[~]|6> o = _ip.options()
[~]|7> o.aut
o.autocall o.autoedit_syntax o.autoindent o.automagic
[~]|7> o.autoedit_syntax = 2
[~]|8>
--
Ville Vainio - http://tinyurl.com/2prnb
http://vainio.blogspot.com
More information about the IPython-user
mailing list