Output a Grafted Tree in Python

Hi.

I want a Grafted Tree.
I try to do this in Python, but the output is not as I expected.
Is there a way to do it?

Thanks.

sample.gh (13.5 KB)

Here’s a thought.
If you simply code in the operation you want applied on the inputs, and plug in the original tree structure, the output should be in corresponding structure

Thanks.

Certainly, I could do it by setting the input option to “Item Access”.
However, in the case of an object created in python, Null is returned.
Is it the wrong way to graft lists?

Also…It does not matter to this problem, why does the option of Input “Item Access” affect the output?


sample.gh (13.3 KB)

The script is still trying to create its own tree structure. Line 27 to 33 of your code can probably just be line 33. Treat inputs as if they were all singular and write your code. Then just plug in whatever data structure and the component should be able to recognize how to execute.

Thanks for the fast reply!

I don’t fully understand it yet, but the problem seems to be solved.