re.search question

Sean 'Shaleh' Perry shalehperry at attbi.com
Thu Aug 1 10:54:38 EDT 2002


> 
> I realize that and agree.  In this case, though, it actually looked to
> me like the regex was the better way and that maybe the "why use regex?"
> was -- this time -- almost a knee jerk in the other direction.
> 
> Personally, I would probably have done a .read(), then used .find() to
> get the locations of the "!" and "end" and then just taken a slice out
> of the string to accomplish the same thing... but I think maybe the
> regex would _still_ have been easier this time.
> 

different people approach programming differently I suppose.  I like the lower
level of control the direct state machine gives me.  I also like that I only
need the input one line at a time rather than in large chunks.  When I do write
file parsers it is almost always for fairly big files.  Loading a 200 thousand
line file in memory just seems wrong and wasteful.  My example was based on
this type of thinking.  Read a little, write a little.




More information about the Python-list mailing list