ghPythonLib Branching Output Comprehension

Hi, I am very pleased to hear about the implementation of the ‘ghpythonlib’ library into Serengeti’s ghPython.
Nevertheless, I have some issues trying to understand how it works.

When I create a nested list within ghPython, I get the normal > IronPython.Runtime.List; however, when I run the below code, the output is not updated as a a tree with branches

import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
import ghpythonlib as gh

a = []

result = list(map(list, (pts0, pts1)))
gh.treehelpers.list_to_tree(result)
a.append(result)
print result

Incidentally, the old way works, but I’d like to get around this extra coding.

import rhinoscriptsyntax as rs
import clr
clr.AddReference("Grasshopper")
import Grasshopper as gh

#input list weaving into nested sublists
result = list(map(list, zip(pts0, pts1)))  

    
def pythonListTGhDataTree(someList):
    
    dataTree = gh.DataTree[object]()
    
    for i,l in enumerate(someList):
        for v in l:
            dataTree.Add(v,gh.Kernel.Data.GH_Path(i))
            
    return dataTree

a = pythonListTGhDataTree(result)

pythonTestingSerengeti.gh (6.8 KB)

Figured it out. This is such a great addition to the library!! :evergreen_tree:

import rhinoscriptsyntax as rs
import ghpythonlib as gh

a = []
b = []

list_a = []
for i in range(10):
    pts = rs.AddPoint(i**2,0,0)
    list_a.append(pts)
    
list_b = []
for i in range(10):
    pts1 = rs.AddPoint(i**2,5,0)
    list_b.append(pts1)

b.extend([list_a, list_b])
a = gh.treehelpers.list_to_tree(b, True, [0])