I’ve tested the script and it seems to work exactly like the vanilla component!
from ghpythonlib import treehelpers
def partition(lt, size=[2,3,2], tree_out=False):
"""Partitions a list into sub-lists.
lt: A list to partition
size: Optional list of partition sizes
tree_out: Optional, if True a tree is returned,
by default a nested list is put out.
A partioned list or tree.
nested_lt = 
n = 0
while len(lt) > size[n]:
sub_lt = lt[:size[n]]
lt = lt[size[n]:]
if n == len(size)-1:
n = 0
n += 1
C = partition(L, S, True)
One thing to consider is that you always need to input a list of sizes, even if you want a regular partition rhythm (e.g. [ [0, 1], [2, 3], [4, 5], [6, 7] ]), you pass in the single size (e.g. 2) as a list (e.g. ) !
you can get ghpythonlib.components to do what you are after.
Be default, and always in Rhino 5, ghpythonlib flattens results that are given as trees. This was done for simplicity, but it turned out that sometimes trees are also useful. For example, in this case.
You can use the trees variable to get access to all trees-aware functions.