This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients docs@python, terry.reedy
Date 2014-07-16.22:47:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1405550850.77.0.279876996055.issue21995@psf.upfronthosting.co.za>
In-reply-to
Content
sys.stdin on 3.4.1 is also 'missing' (among public names) 'line_buffering' (True) and 'mode' ('r'). It seems that these could be trivially added, so the focus of this issue is 'buffer'. The associated 
.detach method is a no-op, (It is also a bit dangerous for interactive operation.)

3.4.1 Console interpreter:
>>> import sys; b = sys.stdin.buffer.readline()
a line
>>> b
b'a line\r\n'

3.4.1 Idle:
>>> import sys; b = sys.stdin.buffer.readline()
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    import sys; b = sys.stdin.buffer.readline()
AttributeError: 'PseudoInputFile' object has no attribute 'buffer'

https://docs.python.org/3/library/sys.html#sys.stdin
presents the idiom. It also warns (too narrowly -- 'if you are writing a library ...') that it might not.

As far as I could find, the Idle doc does not mention the standard streams, let alone Idle specific limitations.

I intentionally wrote the title as a statement of a problematical situation, rather than as a proposed solution, as there are two: change code and change doc.

Code: add .buffer as a bytes-oriented Pseudofile.

Doc: at least mention that standard streams are replaced by objects that ship text between processes, and use gui for input and display, and the consiquences of this.
History
Date User Action Args
2014-07-16 22:47:30terry.reedysetrecipients: + terry.reedy, docs@python
2014-07-16 22:47:30terry.reedysetmessageid: <1405550850.77.0.279876996055.issue21995@psf.upfronthosting.co.za>
2014-07-16 22:47:30terry.reedylinkissue21995 messages
2014-07-16 22:47:30terry.reedycreate