Browse Source

Added initial value for OrderedLifoDict class

pull/79/head
Louis 9 years ago
parent
commit
333581e6fa
  1. 11
      patacrep/songs/chordpro/ast.py

11
patacrep/songs/chordpro/ast.py

@ -16,9 +16,13 @@ class OrderedLifoDict:
- LIFO: the last item is reterned first when iterating.
"""
def __init__(self):
self._keys = []
self._values = {}
def __init__(self, default=None):
if default is None:
self._keys = []
self._values = {}
else:
self._keys = list(default.keys())
self._values = default.copy()
def values(self):
"""Same as :meth:`dict.values`."""
@ -36,7 +40,6 @@ class OrderedLifoDict:
def __getitem__(self, key):
return self._values[key]
def _indent(string):
"""Return and indented version of argument."""
return "\n".join([" {}".format(line) for line in string.split('\n')])

Loading…
Cancel
Save