Skip to content

Use flow with multiple parameters. #509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
michaelbukachi opened this issue Jul 27, 2020 · 9 comments
Closed

Use flow with multiple parameters. #509

michaelbukachi opened this issue Jul 27, 2020 · 9 comments

Comments

@michaelbukachi
Copy link

I can't seem to figure out how to use flow with a function that accepts multiple parameters. All examples in the documentation use functions with a single parameter. Here's a short snippet demonstrating what I'm trying to do:

from returns.pipeline import flow
def add(a, b):
...     return a + b
... 
assert flow(1, 2, add) == 3
@sobolevn
Copy link
Member

I am afraid, that this won't work. You can try to use @curry to achieve that. But, it is currently broken: #462

@michaelbukachi
Copy link
Author

Oh. Guess I have to rollback to use of @pipeline. Is there anybody looking into it? Might try to do a PR.

@sobolevn
Copy link
Member

Do you mean looking into #462?

@michaelbukachi
Copy link
Author

Yes.

@sobolevn
Copy link
Member

sobolevn commented Jul 27, 2020

I would appreciate your help! Thanks a lot!

Also, see python/mypy#9147 and python/mypy#8978

@michaelbukachi
Copy link
Author

Great. Thanks.

@michaelbukachi
Copy link
Author

So the underlying bug is Mypy issue.So it would better to do a PR to mypy right?

@sobolevn
Copy link
Member

Yes. There are two options:

  • solve the issue correctly for nested overloaded by changing how compare works
  • submit my hack with equality check

@sobolevn
Copy link
Member

I am closing this one, let's coordinate in #462

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants