[Tutor] The 'print >>' ogre

Kalle Svensson kalle@gnupung.net
Sun, 17 Feb 2002 23:00:23 +0100

[Danny Yoo, regarding print >>file]
> If we're trying to limit its exposure to the light, we're definitely
> making a judgement that it's either a terrible idea or smells terribly
> bad.  I think it's the latter, and if that's the case, perhaps a strong
> scrubbing is in order.  *grin*

I personally think it's the former.  I think the print statement is a
bad idea too, but not as bad.  What I would prefer is a print
function, something like:

def print(*args, **kwargs):
    if kwargs.has_key("file"):
        f = kwargs["file"]
        f = sys.stdout
    f.write(" ".join(map(str, args)) + "\n")

Anyway, I like your syntax slightly better.  I would prefer something
like "print to f: 'foo', 'bar'" over both.  But if I could have it
erased from Python, that would be the best.

Kalle Svensson (kalle@gnupung.net) - Laziness, impatience, hubris: Pick two!
English: http://www.gnupung.net/  Svenska: http://www.lysator.liu.se/~kalle/
Stuff: ["http://www.%s.org/" % x for x in "gnu debian python emacs".split()]