Grant Edwards wrote:
On 2009-10-17, Dave Angel <da...@ieee.org> wrote:
<snip>
Except sys.stdout.write("hello") doesn't return 5. It returns
None.
I don't know what the OP is talking about when he says "prints
the number of characters":
You're right of course, I should have just tried it. I must have been
thinking of read(), or maybe write() in some other language. But I know
I've seen some problem like this, where the value the interpreter
printed was mixed with what the user wanted.
<snip>
Either put the statement in a real script, or do the following trick to
convince yourself:
dummy = sys.stdout.write("hello")
I don't see why the assignment is needed.
Only if write() had returned a value other than None, which is of course
not how it works, nor how it's documented.
--
http://mail.python.org/mailman/listinfo/python-list