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

Should the graph add all Nodes automatically? #40

Open
PythonFZ opened this issue Mar 2, 2023 · 1 comment
Open

Should the graph add all Nodes automatically? #40

PythonFZ opened this issue Mar 2, 2023 · 1 comment
Assignees

Comments

@PythonFZ
Copy link
Member

PythonFZ commented Mar 2, 2023

We currently have:

import znflow

@znflow.nodify
def add(*args):
   return sum(args)

with znflow.DiGraph() as graph:
   add(1, 2, 3)
   result = add(4, 5, 6)

assert len(graph) == 2

vs

import znflow

@znflow.nodify
def add(*args):
   return sum(args)

with znflow.DiGraph() as graph:
   add(1, 2, 3)
   result = add(4, 5, 6)

   graph.add(result)

assert len(graph) == 1

In other words: Is creating a new Node inside the contextmanager sufficient, to show that this Node is now attached to the graph?

@PythonFZ
Copy link
Member Author

  • keyword argument to disable?

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

4 participants