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

Onion-ring traverse API #18

Open
yzx9 opened this issue May 14, 2024 · 0 comments
Open

Onion-ring traverse API #18

yzx9 opened this issue May 14, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@yzx9
Copy link
Owner

yzx9 commented May 14, 2024

def traverse(next):
  enter = do_something() # same as the enter callback
  children = next(enter)
  leave = do_something_else(children) # same as leave the callback
  return leave

Tree.from_swc(...).traverse(traverse)

The advantage of this onion-ring API design is that users can hold a closure to easily retain some information. However, I am not quite sure if such a call would lead to a too deep call stack (in some extreme cases, a neuron may have hundreds of thousands of points).

@yzx9 yzx9 added the enhancement New feature or request label May 14, 2024
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

1 participant