>
> But it does become worse if you have lots of classes you want to
> serialize. You need to write a default function somewhere that knows about
> all of your classes:
>
Somehow I didn't think of this until now, but when I've needed to use JSON
to serialize a non-trivial hierachy of types, I' es
On Aug 17, 2019, at 00:02, Patryk Gałczyński wrote:
>
> One thing I'm concern about is how it would all relate to _randommodule.c (I
> have little knowledge about C part)
You probably don’t need to change the C code at all. I’m pretty sure none of
these functions are implemented in C, they jus
Hi!
Recently I encountered a situation when I needed to pick a random
population sample but with specific distribution function - paretovariate in
this particular case. After poking around in the random module I found out
that none of the so-called "sequence methods" methods support custom random
On Sat, 17 Aug 2019 at 08:28, Andrew Barnert via Python-ideas
wrote:
> def jsonize_my_tree(obj):
> if isinstance(obj, MyTreeNode):
> return [obj.data(), *map(jsonize_my_tree, obj.children())]
> raise TypeError()
>
> myjson = json.dumps(my_thing_that_might_includ
Ah, that makes sense, thank you for the detailed example and explanation. I
had only read through the start of the previous topic, as it started to
become a bit difficult to follow (largely due to the author being
non-specific with what precisely they were looking for and the discussion
forking off
On Aug 16, 2019, at 20:35, Kyle Stanley wrote:
>
> Speaking of examples, I think it would be helpful to provide a brief example
> of ``object.__json__()`` being used for some added clarity. Would it be a
> direct alias of ``json.dumps()`` with the same exact parameters and usage, or
> would th