Choosing Perl/Python for my particular niche

Fred Ma fma at doe.carleton.ca
Sat Mar 27 02:53:34 EST 2004


Just wanted to add another example of stuff that
I encounter alot of.  As in many computer languages,
various kinds of scopes are delineated by things
like braces or begin/end statements.  I often find
it valuable to find an occurance of certain things
(e.g. certain data declaration) within certain
scope structures.  Sed is convenient for that:

	/SomeStartPattern/,/SomeEndPattern/{
		Do some stuff,
		including conditional branching
	}

To avoid the hassle of writing a script file and
filtering the input source file to an output source
file, I often use gvim's awesome pattern matching
and macro recording abilities.  A sed script file
can look pretty cryptic, especially when I want
to search across physical lines (lots of conditional
flow to append things to the hold buffer, etc..).
For that reason, I tend to stay with quick/dirty
practices in gvim.  Crypticness (though not of the
same variety) is one of the things that I found
hard about ramping up on Perl, to the degree that
I did.  As I hinted earlier, a fair comparison would
account for the fact that its power would be more 
apparent if I became adequately guru-like, but
realistically, I will not spend enough time with
it on a regular basis to expect that.  Here again
is a dichotomy; I appreciate the sed terseness because
I can make a command line pipe stage out of it, but
the same brevity in a scripting language can make for
rough going.  Maybe it's wishful thinking to expect
one language to cover all the bases that I initially
mentioned.

Fred
-- 
Fred Ma
Dept. of Electronics, Carleton University
1125 Colonel By Drive, Ottawa, Ontario
Canada, K1S 5B6



More information about the Python-list mailing list