[Python-Dev] Remove str.find in 3.0?
M.-A. Lemburg
mal at egenix.com
Sun Aug 28 15:10:14 CEST 2005
Raymond Hettinger wrote:
> [Guido]
>
>>Another observation: despite the derogatory remarks about regular
>>expressions, they have one thing going for them: they provide a higher
>>level of abstraction for string parsing, which this is all about.
>>(They are higher level in that you don't have to be counting
>>characters, which is about the lowest-level activity in programming --
>>only counting bytes is lower!)
>>
>>Maybe if we had a *good* way of specifying string parsing we wouldn't
>>be needing to call find() or index() so much at all! (A good example
>>is the code that Raymond lifted from ConfigParser: a semicolon
>>preceded by whitespace starts a comment, other semicolons don't.
>>Surely there ought to be a better way to write that.)
>
> A higher level abstraction is surely the way to go.
I may be missing something, but why invent yet another parsing
method - we already have the re module. I'd suggest to
use it :-)
If re is not fast enough or you want more control over the
parsing process, you could also have a look at mxTextTools:
http://www.egenix.com/files/python/mxTextTools.html
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Aug 28 2005)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
More information about the Python-Dev
mailing list