Skip to content
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

Further explanation needed #1049

Open
EricSchles opened this issue Sep 3, 2021 · 2 comments
Open

Further explanation needed #1049

EricSchles opened this issue Sep 3, 2021 · 2 comments
Labels
documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@EricSchles
Copy link

Hi all,

Big fan of functional programming. I'm glad to see ya'll trying to bring this to Python. My question / request is pretty basic, I hope. I was looking over the docs and I saw:

result: Result[int, Any] = Success(1).map(double)

When looking at this I was confused for a couple of reasons, since the syntax is new to me. But the biggest stumbling block was the:

result:

I couldn't find a clear discussion in the documentation for what thing: means. Can you explain this syntax before using it in the document? I am also confused about why you would set this equal to a type? It's not clear to me how or why this works from a syntax standpoint.

Hope these are fair comments and easy to resolve!

@sobolevn
Copy link
Member

sobolevn commented Sep 3, 2021

Hi! @EricSchles thanks for your question.

result: Result = is a variable with type annotation. It uses the standard Python's syntax: https://www.python.org/dev/peps/pep-0526/#specification

I will add links to peps somewhere early in the docs.

I am also confused about why you would set this equal to a type?

If you are asking about : Result[int, Any] part, we set it because that how type annotations work 🙂
By this we highlight that result variable has Result[int, Any] type.

I hope, that you will like returns! 👍

@sobolevn sobolevn added documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Sep 3, 2021
@EricSchles
Copy link
Author

EricSchles commented Sep 3, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Development

No branches or pull requests

2 participants