Help with IF Conditional Statement

The if node has been bothering me for quite some time. I have created my Python node that works like an IF. It might not be brilliant code but it gets the job done.

"""
Replacement of Dynamo IF node
"""
__author__ = Daniel Gijsbers 
__version__ = '1.0.0'

# Enable Python support and load DesignScript library
import clr

# The inputs to this node will be stored as a list in the IN variables.
ToF = IN[0] # a boolean
List1 = IN[1]
List2 = IN[2]

Result = []

if ToF == True:
	Result.append(List1)
else:
	Result.append(List2)


flattened1 = [item for sublist in Result for item in sublist]

OUT = flattened1
1 Like