[IPython-user] pysh variable substituion and scope
Fernando Perez
fperez.net at gmail.com
Wed Jun 7 13:48:49 CDT 2006
On 6/7/06, Ville Vainio <vivainio at gmail.com> wrote:
> On 6/5/06, Fernando Perez <fperez.net at gmail.com> wrote:
>
> > whatever), and add your modifications there. You can monkeypatch the
> > ipython object to inject your enhanced ipsystem() method, as well as
> > doing anything else you want to propose.
>
> Or less drastically, reassign _ip.system to point to a homebrewed
> system invocation with stack frame traversal etc. :
>
> [~\_ipython]|42> ip = IPython.ipapi.get()
> [~\_ipython]|43> def f(*args): print "hi",args
> |..>
> [~\_ipython]|44> ip.system = f
> [~\_ipython]|45> ls
> hi ('ls.exe ',)
Yes, that's what I meant. I guess monkeypatching refers more to
directly patching the underlying library instead of a running
instance, but that's exactly what I had in mind.
Cheers,
f
More information about the IPython-user
mailing list