News for hackers. Stuff that matters.
Re:A high-performance, zero-overhead, extensible Python comp... by itishappy on Wednesday September 18, 2024 @04:45PM (#41585248)
The json module returns heterogenous dicts.

https://docs.python.org/3/library/json.html

Re:A high-performance, zero-overhead, extensible Python comp... by bpshaver on Wednesday September 18, 2024 @06:53PM (#41586526)
Yeah, just because it can do that doesn't mean that it is good design.
Re:A high-performance, zero-overhead, extensible Python comp... by gpderetta on Thursday September 19, 2024 @08:51AM (#41591334)
how would you represent an arbitrary JSON array in python then? A potentially heterogeneous list seems the obvious solution.
Re:A high-performance, zero-overhead, extensible Python comp... by bpshaver on Thursday September 19, 2024 @02:42PM (#41594981)
Why would I want to do that? I'm rarely ingesting arbitrary JSON. Rather I'm designing my data structures in a sensible way and then maybe serializing them to JSON. Just because JSON can represent heterogenous lists doesn't mean it is a good idea to use heterogenous lists in my programs.
Re:A high-performance, zero-overhead, extensible Python comp... by gpderetta on Friday September 20, 2024 @04:37AM (#41599993)
The JSON spec does not require a schema. If you want to write a library that can support any valid JSON you have little options. That's useful if you are implementing something like jq just to give an example.
Re:A high-performance, zero-overhead, extensible Python comp... by gwking on Thursday September 19, 2024 @09:54AM (#41591854)
It is the design of JSON! Which is a reflection of the same dynamic typing choice made in the original design of Javascript.
Re:A high-performance, zero-overhead, extensible Python comp... by mrguyorama on Thursday September 19, 2024 @01:31PM (#41594220)
They, uh, still aren't wrong hah.

Tell me again why we somehow standardized on sending the equivalent of JSObject.toString() for everything? Especially when "standardized" isn't