python vs awk for simple sysamin tasks
opengeometry at yahoo.ca
Sat Jun 5 00:36:48 CEST 2004
Steve Lamb <grey at despair.dmiyu.org> wrote:
> On 2004-06-04, William Park <opengeometry at yahoo.ca> wrote:
> > I realize that this is Python list, but a dose of reality is needed
> > here. This is typical view of salary/wage recipient who would do
> > anything to waste time and money. How long does it take to type out
> > simple 2 line shell/awk script? And, how long to do it in Python?
> How long does it take me to modify that script a few weeks later
> when my boss asks me, "Y'know, I could really use this and this."
> In shell, quite a few minutes, maybe a half hour. Python? Maybe
> 10 minutes tops.
> How long does it take me to modify it a month or two after that
> when my boss tells me, "We need to add in this feature, exclusions
> are nice, and what about this?" Shell, now pushing a good 30-40m.
> Python, maybe 15m.
Too many maybe's, and you're timing hypotheoretical tasks which you hope
it would take that long.
Will you insist on supporting/modifying your old Python code, even if
it's cheaper and faster to throw it away and write a new code from
scratch? Because that's what Shell/Awk is for... write, throw away,
write, throw away, ...
> It is amazing how much shell bogs down when you're running it over
> several hundred thousand directories. :P
Same would be true for Python here.
> > "Right tool for right job" is the key insight here. Just as Python
> > evolves, other software evolves as well.
> What you're missing is that the job often evolves as well so it is
> better to use a tool which has a broader scope and can evolve with
> the job more so than the quick 'n dirty,
> ultra-specialized, right-tool-for-the-job tool.
> Do I use one-liners? All the time. When I need to delete a
> subset of files or need to parse a particular string out of a
> log-file in a one-off manner. I can chain the tools just as
> effectively as the next guy. But anything more than that and out
> comes Python (previously Perl) because I *knew* as soon as I
> needed a tool more than once I would also find more uses for it,
> would have more uses of it requested of me and I'd have to
> maintain it for months, sometimes years to come.
"If hammer is all you have, then everything becomes a nail". :-)
William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>
No, I will not fix your computer! I'll reformat your harddisk, though.
More information about the Python-list