Ticket #24 (closed defect: worksforme)

Opened 8 years ago

Last modified 8 years ago

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

Reported by: anonymous Owned by: xi
Priority: normal Component: pyyaml
Severity: normal Keywords:


>>> 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


Change History

comment:1 Changed 8 years ago 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 a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.