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

Allow keypaths to preserve order #404

Open
mucmch opened this issue Apr 30, 2024 · 2 comments
Open

Allow keypaths to preserve order #404

mucmch opened this issue Apr 30, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@mucmch
Copy link

mucmch commented Apr 30, 2024

Given a benedict dictionary d, invoking d.keypaths() will return all paths in a sorted order.

There are cases where this is an undesired behavior and is caused by kps.sort() in benedict.core.keypaths.py.

I would propose a new parameter "sorted" to keypaths that allows to disable this line of code.

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@mucmch mucmch added the enhancement New feature or request label Apr 30, 2024
@fabiocaccamo
Copy link
Owner

fabiocaccamo commented Apr 30, 2024

@mucmch I agree with adding a "sorted" parameter to keypaths method (defaults to True for backward compatibility).

Do you want to submit a PR with a couple tests?

@mucmch
Copy link
Author

mucmch commented Apr 30, 2024

Did a simple implementation, but do not manage to commit to Github. I attached a patch file.

keypaths_order.patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

2 participants