https://prefect.io logo
g

Gary Levin

12/07/2020, 9:54 PM
Looking to see if there is a definition of the functional API that can be used in the Flow context in a with statement. I was wondering why
Copy code
with Flow('Arithmetic') as flow:
    x, y = Parameter('x'), Parameter('y')
    operations = {
        '+': x + y,
        '-': x - y,
        '*': x * y,
        '/': x / y
    }
resulted in operations containing {'+': <Task: Add>, '-': <Task: Sub>, '*': <Task: Mul>, '/': <Task: Div>} That is not what python would normally produce for the dict. "x+y" is coerced to <Task: Add>. "+" must be overridden in the Flow context. Where will I find the description of what magic is going on here? For instance, which operators are overridden?
👀 1
is this what you're looking for? special method overloads for
___add___
etc ?
Oh, I just saw your other post, never mind! Sorry