Modify

Ticket #273 (new defect)

Opened 21 months ago

Last modified 44 years ago

PyYAML doesn't dump python dictionary correctly if it only contains strings, numbers and/or booleans

Reported by: freemind Owned by: xi
Priority: normal Component: pyyaml
Severity: normal Keywords:
Cc:

Description

Here's a clear example of what's happening:

>>> mydata = {'person' : 'jesse',
...           'hobby' : 'python',
...           'employed' : True,
...           'family' : ['wife', 'toddler']}
>>> 
>>> print yaml.dump(mydata)
employed: true
family: [wife, toddler]
hobby: python
person: jesse

>>> mydata = {'person' : 'jesse',
...           'hobby' : 'python',
...           'employed' : True,
...           'family' : 'wife'}
>>> print yaml.dump(mydata)
{employed: true, family: wife, hobby: python, person: jesse}

So with a list (and probably any other object) it performs as expected, but with only strings, numbers and/or booleans it doesn't output the yaml document correctly.

Attachments

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from xi. Next status will be 'new'
The owner will be changed from xi to anonymous. Next status will be 'assigned'
Author


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

 
Note: See TracTickets for help on using tickets.