ANN: Sarge, a library wrapping the subprocess module, has been released.
Anh Hai Trinh
anh.hai.trinh at gmail.com
Sun Feb 12 22:57:41 EST 2012
On Monday, February 13, 2012 3:13:17 AM UTC+7, Vinay Sajip wrote:
> On Feb 12, 3:35 pm, Anh Hai Trinh <anh.hai.tr... at gmail.com> wrote:
> > I think most users like to use Python, or they'd use Bash. I think people prefer not another language that is different from both, and having little benefits. My own opinion of course.
> I have looked at pbs and clom: they Pythonify calls to external
> programs by making spawning those look like function calls. There's
> nothing wrong with that, it's just a matter of taste. I find that e.g.
> wc(ls("/etc", "-1"), "-l")
> is not as readable as
> call(“ls /etc –1 | wc –l”)
I don't disagree with it. But the solution is really easy, just call 'sh' and pass it a string!
>>> from extproc import sh
>>> n = int(sh(“ls /etc –1 | wc –l”))
No parser needed written!
Yes there is a danger of argument parsing and globs and all that. But people are aware of it. With string parsing, ambiguity is always there. Even when you have a BNF grammar, people easily make mistakes.
More information about the Python-list