. Python 2.1 function attributes
Barry A. Warsaw
barry at digicool.com
Fri Feb 2 03:24:26 EST 2001
>>>>> "TP" == Tim Peters <tim.one at home.com> writes:
TP> And I'll toss in one marginal one: Lib/smtpd.py has 12
TP> instances of
And I agree, it's marginal. But I wrote that code a looong time
ago[*], I think just after print>> was added, and mostly to experiment
with it. If I did it again today, I probably /would/ use a debug
function (much like I still use a syslog() debug function in
Mailman). Tim's absolutely right, there's still a place for debug
functions, but when print's behavior is what you want, I see no reason
to go through the headaches and ugliness of sys.stdout redirection, or
to re-implement all that behavior in a homegrown function.
I do use print>> quite a bit in my mimelib package (Generator.py)
because it's just so damn convenient and (to me, and I wrote it so I
get to choose :) so much cleaner than either a function or wrapping in
sys.stdout redirection. I really do believe either of those latter
solutions would be uglier, if done correctly, compatibly, and
robustly.
and-email-is-(arguably)-human-readable-ly y'rs,
-Barry
[*] even though it was just recently checked in.
More information about the Python-list
mailing list