Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT: refactor find-replace path datatype #205

Open
tangkong opened this issue Sep 1, 2023 · 0 comments
Open

MNT: refactor find-replace path datatype #205

tangkong opened this issue Sep 1, 2023 · 0 comments

Comments

@tangkong
Copy link
Contributor

tangkong commented Sep 1, 2023

          You might consider making helper classes here to represent attribute access, list indexing, dictionary key grabbing, etc. Super high-level thing that may not apply, but the general thought is:

AttributeItem(child, attr)
ListItem(child, idx).__repr__ = f"{child.name}[{self.idx}"]"
DictKeyItem(child, key).__repr__ = f"{child.name}[{self.key}]"

You have a chain of these that gives you a direct path to the object in question

Then you don't have to worry about passing around special strings and you lock down the expected items coming out of this, etc

Originally posted by @klauer in #198 (comment)

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

No branches or pull requests

1 participant