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

API improvement proposal #46

Closed
mreiche opened this issue May 15, 2023 · 1 comment
Closed

API improvement proposal #46

mreiche opened this issue May 15, 2023 · 1 comment

Comments

@mreiche
Copy link

mreiche commented May 15, 2023

I have the following proposal for a slightly API change.
The expression:

thing = Optional.of(some_func_may_return_none()).get_or_default('23')

could be written in a shorter way like

thing = Optional(some_func_may_return_none()).get('23')

Another idea is, to rename the class to Opt to prevent confusion with the builtin type Optional. So the final expression would be (by default):

from optional import Opt
thing = Opt(some_func_may_return_none()).get('23')
@mreiche
Copy link
Author

mreiche commented May 25, 2023

I've integrated this here: https://github.com/mreiche/python-streams

@mreiche mreiche closed this as completed May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant