I am trying to pass in several lists of floats and integers from grasshopper to hops so I may iterate over these lists to create dictionaries or other data structures of my choosing for operations in packaged not available in GHPython such as numpy and networkx.
The issue I am running into is that when importing these lists from GH, hops seems to solve for each item in the list before moving to the next example:
I noticed this issue when i tried to run a simple “for i in range(len(list))” for my inputs and it threw me the error “object of type ‘float’ has no len()” meaning its taking in the data one at a time.
What is the solution for passing in lists to Hops in a way where it maintains its list structure and is iterable?
Are you setting up the HopsParamAccess properly in the inputs of the component?
hs.HopsString("Fruits", "F", "List of fruits", hs.HopsParamAccess.LIST)
A more elaborated version would be something like this…
@hops.component(
"fruitsalad",
name="Fruit salad",
nickname="FS",
description="A salad of fruits",
inputs=[
hs.HopsString("Fruits", "F", "List of fruits", hs.HopsParamAccess.LIST)
],
outputs=[
hs.HopsString("FruitSalad", "FS", "A delicious fruit salad")
]
)
def create_fruit_salad(my_fruits):
pealed_fruits = peel_fruits(my_fruits)
cutted_fruits = cut_fruits(pealed_fruits)
return make_salad(cutted_fruits)
You can also use hs.HopsParamAccess.TREE. Once in Cpython, the datatree it will become a dictionnary.
Let me know if I missed your question or if this helps 
cheers !
1 Like
This was the correct solution thanks for the insight, super simple fix. Is there a link to a more comprehensive API Reference for Hops to refer to for simple syntax fixes like this? i cant find one quickly online.
-H
Sadly I don’t know much about that…
There’s that topic there, and also their github page
It’s even hard to get replies on this part of the forum recently 
Hops can be such a useful tool, I would love to see the community around it grow. alas.
-H