Skip to content

to_yaml() does not honor ordered_box #104

Open
@philipsd6

Description

@philipsd6
In [1]: from box import Box
In [2]: ordered_box = Box(ordered_box=True)
In [3]: ordered_box.zlast = 'first'
In [4]: ordered_box.afirst = 'last'
In [5]: ordered_box.keys()
Out[5]: ['zlast', 'afirst']  # correct, as expected
In [6]: ordered_box.to_yaml()
Out[6]: 'afirst: last\nzlast: first\n'  # not ordered as expected!

YAML really looks better when ordered logically, not arbitrarily!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions