pyyaml
pyyaml copied to clipboard
safe_dump should dump frozenset as !!set
This works:
>>> yaml.safe_dump(set())
'!!set {}\n'
This also works, though it's kind of weird:
>>> yaml.dump(frozenset())
'!!python/object/apply:__builtin__.frozenset\n- []\n'
This doesn't work:
>>> yaml.safe_dump(frozenset())
# yaml.representer.RepresenterError: cannot represent an object: frozenset([])
Is there any workaround/parameter that allows to do this without manually turning all frozensets to regular sets?