Tom Ritchford
Aug 17, 2021

--

I mean, the idea of switching languages just because you feel one handles JSON better is using a sledgehammer to break an egg.

Python's dataclasses do almost exactly this, anyway, except for that nifty tool to build the classes.

But that isn't part of Go anyway. You could write it pretty fast in Python, and when I get some time, I'll do just that.

Thanks for an interesting and solid article, though, I learned some stuff and got a good idea.

EDIT: Oof, those generated classes Go are short, but ugly!

This struct {“a”: {“b”: [1, 2, 3, true] }}

has the result:

In Python, it would read like this:

Which has less cruft, but the downside of not being able to embed the class definition of B into A.

--

--

No responses yet