sematic icon indicating copy to clipboard operation
sematic copied to clipboard

Always fail when doing __eq__ (and other comparisons) on a future

Open augray opened this issue 2 years ago • 0 comments

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.

augray avatar Aug 11 '22 18:08 augray