Python example: possible speedup?

Martin von Loewis loewis at informatik.hu-berlin.de
Wed Sep 8 14:33:00 EDT 1999


Skip Montanaro <skip at mojam.com> writes:

> Also, instead of calling next_header on a line-by-line basis, how about
> calling it once per package and returning a dict containing the header names
> as keys?  Again, function calling in Python, while flexible, isn't terribly
> efficient.

In addition, you could remove the __current member when doing so. If
there was a next_package method, it would just know that it is at the
beginning of a package (with __current==''), or at EOF. It would read
until EOF, or until it sees an empty line.

Regards,
Martin




More information about the Python-list mailing list