R. David Murray added the comment:

If you break the invariants (in this case: a list has an accurate len) code 
that expects lists is only going to work by accident.

What you really want to do is define your own json encoder for your type.  If 
that isn't possible for a streamed sequence of undefined length, then enhancing 
json's extension machinery to allow it would be a good feature request.

That said, could json's ability to handle this be improved?  Possibly.  I think 
we would accept a patch if it doesn't make the code more complicated.  Ideally 
handling certain cases as "don't care" makes the code simpler, but that may or 
may not be the case here.  Or it may come out as a consequence of the 
enhancement.

----------
nosy: +r.david.murray

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27613>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to