-
Notifications
You must be signed in to change notification settings - Fork 129
Description
Totally out-of-the-box thinking task:
Spec:
The charm library must emit collections in a Comment start stable order Comment end , to avoid bounce in the relation data.
Note that a stable order always exists in JSON, because each object has a string representation, which could be
Leon Mintz
Is it practical to have ops .save do the sorting automatically?
Dima Tisnek
No, not in the general case, because the hypothetical algorithm would have to go inside the user-defined data model, for example class Foo: foo: list[Bar] where Bar may not be comparable.
An argument can be made that JSON representation of Bar are strings and that could be sorted, but that would require the algorithm to find all collections, incl nested, serialise their elements, sort, then wrap in a collection [...].
I'll think about that as a possible helper/metaclass/something!