builtin regular expressions?

Antoine De Groote antoine at vo.lu
Sat Sep 30 14:11:45 EDT 2006


Jorge Godoy wrote:
> Antoine De Groote <antoine at vo.lu> writes:
> 
>> Just to get it clear at the beginning, I started this thread. I'm not a newbie
> 
> Sorry :-)  I got to this wrong conclusion because of the way I read your
> message.

no problem ;-) maybe my formulation was a bit naive, too...

> 
>> an expert either, but I'm quite comfortable with the language by now. It's
>> just that, when I started Python I loved it for its simplicity and for the
>> small amount of code it takes to get something done. So the idea behind my
> 
> See that being "small" is not all that important.  From the Zen of Python:
> 
>     Explicit is better than implicit.
> 
>> original post was that the Perl/Ruby way takes even less to type (for the
>> regex topic of this discussion, I'm not generalizing), and that I like a
>> lot. To me (and I may be alone) the Perl/Ruby way is more "beautiful" (Python
>> culture: Beautiful is better than ugly) than the Python way (in this
>> particular case) and therefore I couldn't see the reasons.
> 
> You can import the re module and use regular expressions in Python, but you
> probably know that.

yes I know that ...   ;-) again

> 
>> Some of you say that this regex stuff is used rarely enough so that being
>> verbose (and therefore more readable ?) is in these few cases the better
>> choice. To me this a perfectly reasonable and maybe it is just true (as far as
>> one can talk about true/false for something subjective as this). I dont' know
>> (yet) ;-)
> 
> It is to me. :-)  If you're parsing simple structures then it might not be to
> you (for complex structures you'd end up with some sort of parser).
> 
>> I just have to learn accept the fact that Python is more verbose more often
>> than Ruby (I don't know Perl really). Don't get me wrong though, I know the
>> benefits of this (at least in some cases) and I can understand that one opts
>> for it. Hopefully I will end up some day preferring the Python way.
> 
> One thing that is also interesting: code completion.  One editor can help you
> write "startswith" but it can't help with "/^".  The same goes for "endswith"
> compared to "$/".  
> 
> I just mentioned this because in the argument of "less code to write leads to
> less bugs" doesn't mean that we have typed all what is written :-)
> 

Excellent point! Love it :-) Helps me overcome it.

Regards,
antoine



More information about the Python-list mailing list