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

research should accept remap args #368

Closed
majidaldo opened this issue Jun 16, 2024 · 3 comments
Closed

research should accept remap args #368

majidaldo opened this issue Jun 16, 2024 · 3 comments

Comments

@majidaldo
Copy link

remap(root, enter=enter)

for the case where you have you custom enter.

@mahmoud
Copy link
Owner

mahmoud commented Jun 17, 2024

Interesting, sure, I guess I could see a custom enter if you were trying to traverse iterables which default_enter doesn't support.

Just looking at this, I think I would change research to use visit instead of enter and then allow a custom enter to be passed. But I don't think there's much value to a custom visit or exit, can you think of any?

@majidaldo
Copy link
Author

majidaldo commented Jun 17, 2024

Interesting, sure, I guess I could see a custom enter if you were trying to traverse iterables which default_enter doesn't support.

Just looking at this, I think I would change research to use visit instead of enter and then allow a custom enter to be passed. But I don't think there's much value to a custom visit or exit, can you think of any?

Didn't understand "and then allow a custom enter to be passed". The case that I had in mind, is when the object at the root is 'custom'... you need a way to compose/decompose.

 from types import SimpleNamespace as NS
 NS(
        a='a',
        b='b',
            c=NS(aa='aa') )

@mahmoud
Copy link
Owner

mahmoud commented Jun 30, 2024

@majidaldo just pushed a PR (#372) that I think is closer to what you might have expected. check out the test to see it in action with SimpleNamespace.

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

2 participants