Skip to content

Fixes #30: Allow usage of lists as paths#34

Merged
akesterson merged 3 commits into
masterfrom
feature/30
Apr 21, 2015
Merged

Fixes #30: Allow usage of lists as paths#34
akesterson merged 3 commits into
masterfrom
feature/30

Conversation

@akesterson
Copy link
Copy Markdown
Collaborator

This will fix #30 . However, it does raise a new concern.

The implementation as-is will not tell a user who is using string paths that their dictionary contains keys with the separator in them. Because of how the code is laid out, I felt it was too hard to make the validator be aware of whether or not the user had originally passed in a string path or a list path, and therefore I just yanked the key validation entirely. But I don't know that this was the right choice. I'm thinking maybe we should create some path object types, and pass those down to dpath.path.*, so that the low level library can know this information. Something like:

class Path:
    def __init__(self, separator='/'):
        self.__separator__ = separator
    def components(self):
        """return all path components of this path"""

class StringPath(Path):
    pass

class ListPath(Path):
    pass

... or something like that. This way the low level lib would know whether or not we should alert the user that their dict has separators in the keys. Of course, this all depends on whether or not we believe we should protect the user. Thoughts?

@calebcase , RFC?

akesterson pushed a commit that referenced this pull request Apr 21, 2015
Fixes #30: Allow usage of lists as paths
@akesterson akesterson merged commit 9be9a0c into master Apr 21, 2015
@calebcase calebcase deleted the feature/30 branch December 30, 2019 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doesn't allow dicts with keys that contain separator in them

1 participant