On Wed, Dec 26, 2018 at 09:48:15AM +0200, Andrew Svetlov wrote:
> The perfect demonstration of io objects complexity.
> `stream.read(N)` can return None by spec if the file is non-blocking
> and have no ready data.
>
> Confusing but still possible and documented behavior.
https://docs.python.org
On Wed, Dec 26, 2018 at 11:26 AM Steven D'Aprano
wrote:
> On Wed, Dec 26, 2018 at 09:48:15AM +0200, Andrew Svetlov wrote:
>
> > The perfect demonstration of io objects complexity.
> > `stream.read(N)` can return None by spec if the file is non-blocking
> > and have no ready data.
> >
> > Confusin
On Wed, Dec 26, 2018, 02:19 Andrew Svetlov
> Also I'm thinking about type annotations in typeshed.
> Now the type is Union[array[int], bytes, bytearray, memoryview]
> Should it be Union[io.BinaryIO, array[int], bytes, bytearray, memoryview] ?
>
Yeah, trying to support both buffers and file-like o
On Wed, Dec 26, 2018 at 03:10:05AM -0800, Nathaniel Smith wrote:
> On Wed, Dec 26, 2018, 02:19 Andrew Svetlov
> >
> > Also I'm thinking about type annotations in typeshed.
> > Now the type is Union[array[int], bytes, bytearray, memoryview]
> > Should it be Union[io.BinaryIO, array[int], bytes, by
On Wed, Dec 26, 2018 at 12:18:23PM +0200, Andrew Svetlov wrote:
[...]
> > json is correct: if `read()` is called without argument it reads the whole
> content until EOF.
> But with size argument the is different for interactive and non-interactive
> streams.
> RawIOBase and BufferedIOBase also hav
On Wed, 26 Dec 2018 at 09:26, Steven D'Aprano wrote:
> Regardless, my point doesn't change. That has nothing to do with the
> behaviour of unpack. If you pass a non-blocking file-like object which
> returns None, you get exactly the same exception as if you wrote
>
> unpack(fmt, f.read(size))
On 26Dec2018 12:18, Andrew Svetlov wrote:
On Wed, Dec 26, 2018 at 11:26 AM Steven D'Aprano
wrote:
On Wed, Dec 26, 2018 at 09:48:15AM +0200, Andrew Svetlov wrote:
> The perfect demonstration of io objects complexity.
> `stream.read(N)` can return None by spec if the file is non-blocking
> and
On Wed, Dec 26, 2018 at 01:32:38PM +, Paul Moore wrote:
> On Wed, 26 Dec 2018 at 09:26, Steven D'Aprano wrote:
> > Regardless, my point doesn't change. That has nothing to do with the
> > behaviour of unpack. If you pass a non-blocking file-like object which
> > returns None, you get exactly t
> And this is why I, personally, think augumenting struct.unpack and json.read
> and a myriad of other arbitrary methods to accept both file-like things and
> bytes is an open ended can of worms.
>
> And it is why I wrote myself my CornuCopyBuffer class (see my other post in
> this thread).
On Thu, Dec 27, 2018 at 10:02:09AM +1100, Cameron Simpson wrote:
[...]
> >Also I'm thinking about type annotations in typeshed.
> >Now the type is Union[array[int], bytes, bytearray, memoryview]
> >Should it be Union[io.BinaryIO, array[int], bytes, bytearray,
> >memoryview] ?
>
> And this is why
I'm quoting Steve's post here but am responding more broadly to the
whole thread too.
On Thu, Dec 27, 2018 at 1:00 PM Steven D'Aprano wrote:
> I assume you have no objection to the existence of json.load() and
> json.loads() functions. (If you do think they're a bad idea, I don't
> know what to s
On 27Dec2018 02:53, Anders Hovmöller wrote:
And this is why I, personally, think augumenting struct.unpack and json.read
and a myriad of other arbitrary methods to accept both file-like things and
bytes is an open ended can of worms.
And it is why I wrote myself my CornuCopyBuffer class (se
On 27Dec2018 12:59, Steven D'Aprano wrote:
On Thu, Dec 27, 2018 at 10:02:09AM +1100, Cameron Simpson wrote:
[...]
>Also I'm thinking about type annotations in typeshed.
>Now the type is Union[array[int], bytes, bytearray, memoryview]
>Should it be Union[io.BinaryIO, array[int], bytes, bytearray
13 matches
Mail list logo