pyyaml icon indicating copy to clipboard operation
pyyaml copied to clipboard

Documentation out of date?

Open alphaniner opened this issue 2 years ago • 0 comments

According to the documentation (both at pyyaml.org as well as help(yaml)) the default value of default_flow_style is None. But I get different output if I explicitly specify it:

>>> mydict = {'key': {'a_string': 'a string', 'a_list': ['a', 'b']}}
>>> print(yaml.dump(mydict))
key:
  a_list:
  - a
  - b
  a_string: a string

>>> print(yaml.dump(mydict, default_flow_style=None))
key:
  a_list: [a, b]
  a_string: a string

Unless I'm misunderstanding something, it seems the documentation was never updated to reflect #199/https://github.com/yaml/pyyaml/commit/f20936573840842954b933801abeeaedad977b41.

Edit: Additionally, I just noticed that the pyyaml.org documentation doesn't mention the sort_keys argument for dump.

alphaniner avatar Jul 23 '22 00:07 alphaniner