How to Handle Variable Input List Length/Nesting in Custom Nodes (Python)


Hello there…

i like your example a lot but i am not able to modify it to suit my needs…

Like the OP said :
is there a way to create a list of lists ? And the lists contained by the Master list to be of variable size.

I mean a list that gets a list - adds it.
gets another list - adds it. without having a finite max number of lists… meaning without knowing in advance how many lists we will add.

I plan on using this by getting the CurrentSelection - grab that list and add it to the Master list,
then update the CurrentSelection - grab this second list and add it to the Master list… and so on.

your example seems to be doing this…
all i can find online is people using List.Create and using the " + " button in the node to add more lists…but this does not help me.

so… help please?

i tried editing the script to just add the list, it only refreshes the list along with the CurrentSelection 's list…? :smiley:

i am a noob in Dynamo/zero xp with python…

it does not add new lists to the list…

or maybe in my second try use a variable i =0 then first list will be added in the list[i] position?

is there a way to say "add list to position i " in the Master list, then increment i with every run of the function that adds lists to the Master list?

in Java when you say list.add(something) the list gets populated, even with duplicates…it adds stuff to the end, starting with index 0.