JSON-encoding very long iterators

Alfred Morgan alfred at 54.org
Wed Oct 1 12:13:51 CEST 2014


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?



More information about the Python-list mailing list