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

Support pop for lists #78

Open
aparcar opened this issue Apr 3, 2021 · 0 comments
Open

Support pop for lists #78

aparcar opened this issue Apr 3, 2021 · 0 comments

Comments

@aparcar
Copy link

aparcar commented Apr 3, 2021

Is there a way do pop or remove elements from lists?

Say I have a dotty like dot["foo.bar.0"] = 1, I'd like to pop that element. Something like dot.pop("foo.bar.0") doesn't work. My only idea at this point is to split the path and pop it like dot["foo.bar"].pop(0).

path = "foo.bar.0"
parent, element = path.rsplit(separator, maxsplit=1)
dot[parent].pop(element)
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