PEP 214 - Why not print >> string?

Aahz Maruch aahz at
Fri Jan 11 16:05:09 CET 2002

[p&e per poster's request, but do *not* cc me in e-mail]

In article <B8631E26.17D53%me at>,
Aaron Swartz  <me at> wrote:
>It seems to me that this and other similar functions would be more
>appropriate returning strings, so that their values can be used in other
>ways and combined into expressions like len(tables(1)). (Yet still easily
>written to a file as: "print >> file, tables(val)".) Of course, one can
>always use a StringIO object, but this feels rather kludgey.

Why does using a [c]StringIO object feel kludgy?  After all, your
proposal already requires x='' and using a "normal" file requires an
open(), so what's wrong with x=StringIO()?
                      --- Aahz  <*>  (Copyright 2002 by aahz at

Hugs and backrubs -- I break Rule 6       
Androgynous poly kinky vanilla queer het Pythonista   

"There are times when effort is important and necessary, but this should
not be taken as any kind of moral imperative."  --jdecker

More information about the Python-list mailing list