swaroopch / edn_format

EDN reader and writer implementation in Python, using PLY (lex, yacc)
https://swaroopch.com/2012/12/24/edn-format-python/
Other
131 stars 31 forks source link

Add a sort_sets optional keyword argument to dump #42

Closed bfontaine closed 6 years ago

bfontaine commented 6 years ago

This is similar to sort_keys but for sets.

I’ve a program that dumps a resource as EDN every day and triggers some action based on the diff between the old and the new dump. It works great except for sets because the order in which their members are dumped isn’t always the same so the diff may be non-empty even if there isn’t any change.

This sort_sets boolean key fixes that issue: it sorts sets before dumping them, thus ensuring two dumps are equal if they were generated from the same input.

It’s false by default, so the current behavior is not affected if you don’t use the key.

bfontaine commented 6 years ago

CI is failing because of a style issue unrelated to this PR Update: fixed with #44.