Hello,
I often use “None” to output a null value in Python.
However, in the new script editor it is outputting as its string representation “None”
If I set the type hint on the output to float then I get the proper null i expect (because the float didn’t know how to convert the None text…) but I get the error:
- Parameter “Value (V)” type conversion failed from Goo to float
My question is, if my output list is the result of summated numbers why am I getting it returned as a string? Also, either way, if I say “make this item None” shouldn’t it return regardless of it being a float, string, or anything unless I explicitly cast it to string such as: a = str(None)
I’m confused, is this a bug or user error?
Here’s the snip from the code trying to handle the None condition:
def Convert_To_Model_Units(V):
converted_values = []
for value in V:
if value:
parsed_values = Parse_String(value)
unit_systems = Get_Unit_System(parsed_values)
converted_value = Convert_Units(parsed_values, unit_systems)
converted_values.append(converted_value)
else:
converted_values.append(None)
return converted_values
Thanks for the help!