Raymond Hettinger added the comment: See also, the same feature request from Tarek Ziadé, http://bugs.python.org/issue29663 , "collections.deque could be serialized in JSON as a simple array. The only thing we can lose in the process is the maxlen value, but I think it's a decent behaviour to ignore it when encoding and to set it to None when decoding."
+1 from me as well. This isn't really different that how we handle tuples and I can see that it would be useful to be able to dump a deque into JSON. I concur that it is reasonable to ignore maxlen because that is primarily a convenience feature (auto-popping on overflow) rather than something that is intrinsic to the semantics of data itself. For now, just adding deque support is reasonable. We can't just do all sequences because string/bytearray like objects would need to be excluded. ---------- versions: +Python 3.7 -Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20774> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com