Repeated calls to `resolve` can experience performance degredation, if
`add_implicit_resolver` has been called with `first=None` (to add an
implicit resolver with an unspecified first character).
For example, every time `foo` is encountered, the "wildcard implicit
resolvers" (with `first=None`) will be appended to the list of implicit
resolvers for strings starting with `f`, which will normally be the
resolver for booleans. The list `yaml_implicit_resolvers['f']` will keep
getting longer. The same behavior applies for any first-letter matches
with existing implicit resolvers.
This change avoids unintentionally mutating the lists in the class-level
dict `yaml_implicit_resolvers` by looping through a temporary copy.
Fixes: #439
Hold references to the objects being represented (should fix#22).
The value of a mapping node is represented as a list of pairs `(key, value)`
now.
Sort dictionary items (fix#23).
Recursive structures are now loaded and dumped correctly, including complex
structures like recursive tuples (fix#5). Thanks Peter Murphy for the patches.
To make it possible, representer functions are allowed to be generators.
In this case, the first generated value is an object. Other values produced
by the representer are ignored.
Make Representer not try to guess `!!pairs` when a list is represented.
You need to construct a `!!pairs` node explicitly now.
Do not check for duplicate mapping keys as it didn't work correctly anyway.