Comparison of parsers in python?

andrew cooke andrew at acooke.org
Sun Sep 20 07:55:25 EDT 2009


On Sep 19, 11:39 pm, TerryP <bigboss1... at gmail.com> wrote:
[...]
> For flat data, simple unix style rc or dos style ini file will often
> suffice, and writing a parser is fairly trivial; in fact writing a
[...]

python already includes parsers for ".ini" configuration files.

[...]
> The best way to choose a parser, is experiment with several, test (and
> profile!) them according to the project, then pick the one you like
> best, out of those that are suitable for the task. Profiling can be
> very important.

profiling is going to show you the constant complexity, but - unless
you think hard - it's not going to explain how a parser will scale
(how performance changes as the amount of text to be parsed
increases).  for that, you need to look at the algorithm used, which
is usually documented somewhere.  there's going to be trade-offs -
parsers that handle large texts better could well be more complex and
slower on small texts.

andrew



More information about the Python-list mailing list