[Python-Dev] Replacement for print in Python 3.0
Bob Ippolito
bob at redivi.com
Thu Sep 1 23:49:56 CEST 2005
On Sep 1, 2005, at 2:27 PM, Jack Diederich wrote:
> On Thu, Sep 01, 2005 at 11:12:57PM +0200, Fredrik Lundh wrote:
>
>> Charles Cazabon wrote:
>>
>>
>>> in fact, it does nothing for the program but merely has the
>>> interesting
>>> side-effect of writing to stdout.
>>>
>>
>> yeah, real programmers don't generate output.
>>
>>
> I'd say:
> yeah, real programmers don't generate output _to stdout_
>
> sockets, GUI widgets, buffers? sure. stdout? Almost never.
> Most of these don't have write() methods so I've never had a reason to
> use the "print >>" syntax.
That is absolutely true, print is becoming less and less useful in
the context of GUI or web applications. Even in Just Debugging
scenarios, you're probably better off using something with more
flexibility, such as the logging module.
Additionally, the fact that sys.stdout is for bytes and not a text
(unicode) makes it even more complicated. You can, of course,
replace sys.stdout with an encoding-aware wrapper via codecs.getwriter
(), but that's often inconvenient.
-bob
More information about the Python-Dev
mailing list