how to avoid leading white spaces

rurpy at yahoo.com rurpy at yahoo.com
Fri Jun 3 11:14:30 EDT 2011


On 06/03/2011 07:17 AM, Neil Cerutti wrote:
> On 2011-06-03, rurpy at yahoo.com <rurpy at yahoo.com> wrote:
>> The other tradeoff, applying both to Perl and Python is with
>> maintenance.  As mentioned above, even when today's
>> requirements can be solved with some code involving several
>> string functions, indexes, and conditionals, when those
>> requirements change, it is usually a lot harder to modify that
>> code than a RE.
>>
>> In short, although your observations are true to some extent,
>> they are not sufficient to justify the anti-RE attitude often
>> seen here.
>
> Very good article. Thanks. I mostly wanted to combat the notion
> that that the alleged anti-RE attitude here might be caused by an
> opposition to Perl culture.
>
> I contend that the anti-RE attitude sometimes seen here is caused
> by dissatisfaction with regexes in general combined with an
> aversion to the re module. I agree that it's not that bad, but
> it's clunky enough that it does contribute to making it my last
> resort.

But I questioned the reasons given (not as efficient, not built
in, not often needed) for dissatisfaction with REs.[*]  If those
reasons are not strong, then is not their Perl-smell still a leading
candidate for explaining the anti-RE attitude here?

Of course the whole question, lacking some serious group-psychological
investigation, is pure speculation anyway.

----
[*] A reason for not using REs not mentioned yet is that REs take
some time to learn.  Thus, although most people will know how to use
Python string methods, only a subset of those will be familiar with
REs.  But that doesn't seem like a reason for RE bashing either
since REs are easier to learn than SQL and one frequently sees
recommendations here to use sqlite.



More information about the Python-list mailing list