Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #78533

Re: JSON-encoding very long iterators

Newsgroups comp.lang.python
Date 2014-10-01 03:13 -0700
References <4232c92a-101c-4a1b-89b2-e80d67ef7bc6@googlegroups.com> <mailman.14479.1412042377.18130.python-list@python.org>
Message-ID <209e604c-1a18-43ff-9358-12fb784d3d4c@googlegroups.com> (permalink)
Subject Re: JSON-encoding very long iterators
From Alfred Morgan <alfred@54.org>

Show all headers | View raw


On Monday, September 29, 2014 7:10:18 PM UTC-7, Ian wrote:
> This would cause things that aren't lists to be encoded as lists.
> Sometimes that may be desirable, but in general if e.g. a file object
> sneaks its way into your JSON encode call, it is more likely correct
> to raise an error than to silently encode the file as if it were a
> list of strings.  So it should not be the default behavior. That said,
> it sounds like it could be made easier to enable streaming from
> iterators as an option for those cases where it's desired.

I added a stream flag (off by default) and also added file streaming (thanks for the idea).

https://github.com/Zectbumo/cpython/compare/2.7

What do you think now?

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

JSON-encoding very long iterators alfred@54.org - 2014-09-29 18:19 -0700
  Re: JSON-encoding very long iterators Ian Kelly <ian.g.kelly@gmail.com> - 2014-09-29 19:58 -0600
    Re: JSON-encoding very long iterators Alfred Morgan <alfred@54.org> - 2014-10-01 03:13 -0700
      Re: JSON-encoding very long iterators Chris Angelico <rosuav@gmail.com> - 2014-10-01 23:06 +1000
        Re: JSON-encoding very long iterators Alfred Morgan <alfred@54.org> - 2014-10-01 15:01 -0700
          Re: JSON-encoding very long iterators Chris Angelico <rosuav@gmail.com> - 2014-10-02 08:54 +1000
            Re: JSON-encoding very long iterators Alfred Morgan <alfred@54.org> - 2014-10-01 23:05 -0700
              Re: JSON-encoding very long iterators Chris Angelico <rosuav@gmail.com> - 2014-10-02 16:33 +1000
                Re: JSON-encoding very long iterators Alfred Morgan <alfred@54.org> - 2014-10-01 23:49 -0700

csiph-web