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

ENH: Allow chained splitting of different fields #680

Open
tclose opened this issue Aug 1, 2023 · 1 comment
Open

ENH: Allow chained splitting of different fields #680

tclose opened this issue Aug 1, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@tclose
Copy link
Contributor

tclose commented Aug 1, 2023

What would you like changed/added and why?

Would like to support chained splitting, i.e. for

node.split(a=[1, 2]).split(b=[3, 4])

to be equivalent to

node.split(a=[1, 2], b=[3, 4])

What would be the benefit? Does the change make something easier to use?

More flexible syntax made available to the end user

@tclose tclose added the enhancement New feature or request label Aug 1, 2023
@tclose tclose mentioned this issue Aug 1, 2023
2 tasks
@effigies
Copy link
Contributor

effigies commented Aug 2, 2023

This would allow you to do something like:

node.split(a=[1, 2])
if cond:
    node.split(b=[3, 4])

instead of

if cond:
    node.split(a=[1, 2])
else:
    node.split(a=[1, 2], b=[3, 4])

or

splits = {'a': [1, 2]}
if cond:
    splits['b'] = [3, 4]
node.split(**splits)

As long as splits are "outer" by default, there is no ambiguity in adding splits sequentially. A downstream node is already split by its upstream nodes.

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
None yet
Development

No branches or pull requests

2 participants