Ticket #24 (closed defect: worksforme)

Opened 4 years ago

Last modified 4 years ago

dictionaries without at least one list element as values seem not to work

Reported by: anonymous Assigned to: xi
Priority: normal Component: pyyaml
Severity: normal Keywords:
Cc:

Description

>>> print yaml.dump({'name': 'Silenthand Olleander', 'race': 'Human', 'traits': 1})
{traits: 1, race: Human, name: Silenthand Olleander}
>>> print yaml.dump({'name': 'Silenthand Olleander', 'race': 'Human', 'traits': [1,2]})

traits: [1, 2]
race: Human
name: Silenthand Olleander

it seems without a list as at least one value element in dict the dump is not working properly

Attachments

Change History

08/08/06 08:25:50 changed by xi

  • status changed from new to closed.
  • resolution set to worksforme.

First, it's not a bug. Second, it's duplicate of #18.

It's a correct output despite the fact that the style of the nested mapping is different.

If you want collections to be always serialized in a block style, try

>>> print yaml.dump({'name': 'Silenthand Olleander', 'race': 'Human', 'traits': 1}, default_flow_style=False)
name: Silenthand Olleander
race: Human
traits: 1

Add/Change #24 (dictionaries without at least one list element as values seem not to work)




Change Properties
Action