![](https://secure.gravatar.com/avatar/d4a7fc39d443767abbe16fc219bf3910.jpg?s=120&d=mm&r=g)
On 4 March 2013 05:16, Benjamin Peterson <benjamin@python.org> wrote:
Robert Collins <robertc@...> writes:
There doesn't seem to be a way to safely use detach() on stdin - I'd like to get down to the raw stream, but after calling detach(), the initial BufferedIOReader is unusable - so you cannot retrieve any buffered content) - and unless you detach(), you can't guarantee that the buffer will ever be empty.
Presumably if you call it before anyone else has had a chance to read from it, you should be okay.
Thats hard to guarantee in the general case: consider a library utility that accepts an input stream. To make it concrete, consider dispatching to different processors based on the first few bytes of a stream: you'd have to force raw IO handling everywhere, rather than just the portion of code that needs it... -Rob -- Robert Collins <rbtcollins@hp.com> Distinguished Technologist HP Cloud Services