easy question on input files in Python

robin.escalation at ACM.org robin.escalation at ACM.org
Tue Dec 5 08:35:52 EST 2000

"Alex Martelli" <aleaxit at yahoo.com> wrote:

>The one I like *least* goes:
>line = file.readline()
>while line:
>    process(line)
>    line = file.readline()

Just a quick note that if performance matters, do not actually call
another function to do the processing as process(line) shows. Do the
processing in-line. This can make a huge difference due to the
overhead of function calls. I know this from experience.

Any experts know why the overhead is so great in Python?

robin                          robin at illusionsexeculink.com
media artist /                 remove illusions to reply
information architect          www.execulink.com/~robin/

Isolation tank paves way to execute an attack.

More information about the Python-list mailing list