By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,746 Members | 1,208 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,746 IT Pros & Developers. It's quick & easy.

sys.stderr.write returns string length in Python 3

P: n/a
Is this new behavior intentional? ::
>>sys.stderr.write("thisisatest\n")
thisisatest
12

Here is the reason for it:
>>help(sys.stderr.write)
Help on method write in module io:
write(self, s: str) method of io.TextIOWrapper instance

Thank you,
Alan Isaac
Jul 22 '08 #1
Share this Question
Share on Google+
3 Replies

P: n/a


Alan G Isaac wrote:
Is this new behavior intentional? ::
Yes, it's in the PEP http://www.python.org/dev/peps/pep-3116/.
>
>>sys.stderr.write("thisisatest\n")
thisisatest
12

Here is the reason for it:

>>help(sys.stderr.write)
Help on method write in module io:
write(self, s: str) method of io.TextIOWrapper instance

Thank you,
Alan Isaac
Jul 23 '08 #2

P: n/a
Benjamin wrote:
http://www.python.org/dev/peps/pep-3116/.
Thanks.
Can you give me an example of using the returned value?
Alan
Jul 23 '08 #3

P: n/a
Alan G Isaac wrote:
Can you give me an example of using the returned value?
it's for consistency with stream objects that support raw I/O (as
described in the PEP). when using buffered I/O, you can ignore it.

</F>

Jul 23 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.