Looking under Python's hood: Will we find a high performance or clunky engine?

Heiko Wundram modelnine at modelnine.org
Sun Jan 22 12:52:21 EST 2012

Am 22.01.2012 16:50, schrieb Rick Johnson:
> What does Python do when presented with this code?
> py>  [line.strip('\n') for line in f.readlines()]
> If Python reads all the file lines first and THEN iterates AGAIN to do
> the strip; we are driving a Fred flintstone mobile. If however Python
> strips each line of the lines passed into readlines in one fell swoop,
> we made the correct choice.
> Which is it Pythonistas? Which is it?

You aren't one (considering how vocal you are in arguing for changes to 
the language)?

So: shouldn't you be able to answer your own question?

--- Heiko.

More information about the Python-list mailing list