Modify

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

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
View

Add a comment

Modify Ticket

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


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

 
Note: See TracTickets for help on using tickets.