matching one time through a loop

Kragen Sitaker kragen at pobox.com
Sat Jun 1 01:55:30 EDT 2002


Peter Hansen <peter at engcorp.com> writes:
> I believe "programmer productivity" is significantly improved when 
> using Python, especially because of the emphasis on readability.
> 
> Productivity needs to include not just the time to type the statement,
> which is a miniscule portion of the overall effort, but also the
> time to revise the design repeatedly (assuming code-and-fix, which 
> 95% of programmers use) or the time to write test cases, whether
> after (for 4% of programmers) or incrementally during (for those
> using Test-Driven Development).  In all cases, code maintenance is
> a far greater proportion of the work than mere typing, and I 
> really don't believe the minor time savings when typing provided by Perl

I find aline = re.sub(r'\s+', aline, ' ') less readable than
$aline =~ s/\s+/ /g;, but maybe that's because I've used Perl since
1994 and Python only since 1999 or so.  In particular, I never have to
look up the order of arguments in the Perl construct.  aline =
re.compile(r'\s+').sub(aline, ' ') is only marginally better, and its
readability (like that of recent Python-URL!s) suffers because of
verbosity.




More information about the Python-list mailing list