[IPython-dev] Re: [IPython-user] pysh is in CVS
Fernando.Perez at colorado.edu
Mon Jun 28 11:14:04 EDT 2004
Daniel 'Dang' Griffith wrote:
> Wow! I had a minor problems because there some executables
> in my path with the same names as some Windows built-ins (e.g.,
> dir.exe, mkdir.exe, rmdir.exe). After running rehashx, IPython was
> running them, rather than the built-in. I was unaware of their
> presence until this time; I deleted them, and life is good again.
Yes, this is a bit of an annoyance. It is in principle possible to have
multiple internal namespaces for commands, I just didn't want to deal with
such hassles for now. A true shell (bash, tcsh, etc) keeps at least 3
namespaces: $PATH commands, user aliases and shell builtins. For ipython's
shell functionality, I've lumped all these into one, since I already have to
worry about managing the magic and python language namespaces as well. But it
might be a good idea to at least have two: one for commands and one for user
It's not that hard, just a bit time-consuming because the two dicts have to be
managed carefully so it remains transparent to the user and doesn't slow
things down noticeably. Keep in mind that ipython has to remain responsive
enough that you don't really notice any delay after pressing <Return>. This
means that whatever fancy magic it does, has to be finished in about 0.1s,
which is roughly the human threshold for noticing 'slugishness'. So I try
very hard to keep the mainloop very tight so as to respect this constraint on
reasonable hardware (my laptop is a 1.1GHz P-III, so I think it's a good
middle-of-the-road benchmark these days). If you actually look at the code,
you'll see that I'm using a fairly stretchy definiton of 'tight' here, but
that's a topic for another day. Let's just say that I try my best :)
> Great update! I'll keep you posted if I see any strangenesses.
> It's really cool to be able to run 'jar', to access zip files, without
> needing two windows open (an IPython and a command prompt).
Glad you like it!
> What do you mean about builtin piping? I ask, because "ls /s | more"
> works just fine. And if I re-aliasing ls to ls.exe, "ls -R | less" works
> just fine as well.
Yes, this works because the whole line is passed to the shell, which is the
one handling the pipes. What I meant was to write a bunch of _python_
utilities which simulate piping by overriding the '|' operator so you can
simulate pipes in true python code. There's an ASPN recipe on that if you
feel like googling a bit. I won't go that far, but as you correctly point
out, 'regular' piping works just fine, courtesy of the underlying system shell.
Thanks for your report, and keep me posted on any issues you may encounter.
More information about the IPython-dev