Skip to content

Work with non-iterable dictionaries. #127

@calebcase

Description

@calebcase

The way dpath.util.get is implemented means that it requires all parts of the tree to be iterable. So if you have a node which is a dictionary, but isn't iterable, it does not allow you to find the children under that node. This is a consequence of using fold and walk to implement get. This is also not efficient if the node is a map (that is, it still iterates over the keys when it could do a direct lookup).

To make get more efficient and also allow non-iterable maps we need use kvs only when the related segment is a glob (that is, only iterate over them if it is strictly necessary). This means we can't use fold or walk anymore. There probably is additional fallout in the other methods like view and search. Unfortunately this will require some significant changes.

Originally reported here:
https://github.com/akesterson/dpath-python/pull/122/files#diff-f50eb92b27ecc897863ec0f0ef4f0f65R52-R66

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions