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

Rick Johnson rantingrickjohnson at gmail.com
Sun Jan 22 20:04:16 EST 2012

On Jan 22, 6:38 pm, Michael Torrie <torr... at gmail.com> wrote:
> On 01/22/2012 08:50 AM, Rick Johnson wrote:
> > 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're doing it wrong, obviously.  I'm actually surprised that an expert
> such as yourself would read a file in this way.  In any language.
> Surely you would iterate over the file object which is the obvious way
> to do it.

That's just the point. If an expert such as myself can make a simple
mistake as this, then one can only expect that the neophytes are going
to suffer greatly. I wonder how many tutorials are out there in WWW
still teaching old ways of writing Python code? Old ways that have
been superseded by newer versions.

> I guess we'll chalk this up as another python pitfall.  Looking forward
> to your programming language which will prevent such things while
> maintaining the purity and beauty of Python's ideals.

Purity is a myth perpetrated by those who are blinded by their own
sanctimonious ideals of self worth. Any language that vows to be
"pure" (in a backwards compatible sense) is doomed to bitrot.

Programming languages and creators have a father and daughter

The creator (father) wants his language (daughter) to be pure forever
and ever. You can lock her away in a tower with a titanium chastity
belt and stick your head in the sand but sooner or later a prince
charming (evolution) is going to come along and defile her. Will you
have the strength to realize that your daughters life is more
important than your feeble attachments to nostalgic purity?

The fact is, Python's purity has been defiled already. And although we
must give GvR the credit he deserves for making these long overdue
changes, he did not go far enough. Essentially he has accepted his
daughter will not longer be pure but he refuses to acknowledge the new
communion. His internal drive to evolve hath waxed cold. He has the
license plate and the job title and that seems to be enough. Where is
the passion?

More information about the Python-list mailing list