Hacker News new | ask | show | jobs
by ketralnis 739 days ago
If the UI is my shell then it is. If it's part of a larger script being executed by python embedded in a cron job wrapped in a burrito, it may not be
3 comments

If you've got Python, you shouldn't be running grep within it, just open the file with Python and search through it in the usual ways. Far less flaky than a subprocess.
Shouldn't, sure. But people use software in all kinds of sub-optimal ways, and it would behoove an author to make sure that it doesn't fail dramatically when this happens.
I'm not even sure it's suboptimal to shell out to grep instead of writing a bespoke search in Python. It would depend on the amount of data I'm sifting through.

Grep is very optimized for what it does.

You misunderstand entirely how much the author of any software with "achievements" cares about whether it works well in shell scripts and/or from python.
Wrappers are still responsible for proxying or handling errors and wrappers that fail to do so are wrapping poorly.
Don't bring monads into this