New submission from Terry J. Reedy:
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.
----------
assignee: docs@python
components: Documentation, IDLE
messages: 223292
nosy: docs@python, terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: Idle: pseudofiles have no buffer attribute.
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue21995>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com