sematic
sematic copied to clipboard
Always fail when doing __eq__ (and other comparisons) on a future
You can hit weird cases that behave in unexpected ways when you try to compare futures:
@sematic.func
def pipeline() -> str:
if some_sematic_func() == 1:
return "Yay!"
else:
return "Boo!"
No matter whether some_sematic_func()
resolves to a 1 or not, this will always return "Boo!"
because what's actually being compared is Future(...) == 1
, which will always be False. We should save users from this and similar gotchas (other comparison operators) with good error messages.