List access internal switch?

Is it possible from inside the code to create some sort of a switch so that if it is a single object the input to have a flag ‘Item Access’ and if it is a list of objects to act as ‘List Access’?

I presume you mean code in GhPython. I don’t think so. Why would that be important?

Yes ghpython but to be compiled afterwards. That’s why it is important.

Assume I have a need for different equations to be calculated when it is a single object (eq1) and if it’s several objects as list - eq2.

All I can think of right now is to set it as List Access and calculate with the first equation if len(input) == 1.

However there are two possible scenarios:

  • multiple single objects provided as a list - needed to be calculated with eq1 (Item Access)
  • multiple lists of objects that need to be calculated with eq2. (List Access)

To avoid creating different components or different inputs one with Item Access and one with List Access. I would need another input boolean to switch between them manually. If there’s no dynamic solution that is.