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

Rework maybe. #2593

Merged
merged 3 commits into from
Jan 25, 2023
Merged

Rework maybe. #2593

merged 3 commits into from
Jan 25, 2023

Conversation

jaheba
Copy link
Contributor

@jaheba jaheba commented Jan 25, 2023

  • Swap operands for map_or and map_or_else such that the function argument comes before the default argument.
  • Add Maybe class so one can do Maybe(x).unwrap() in addition to unwrap(x), etc.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Please tag this pr with at least one of these labels to make our release process faster: BREAKING, new feature, bug fix, other change, dev setup

Jasper Zschiegner added 2 commits January 25, 2023 10:11
* Swap operands for `map_or` and `map_or_else` such
  that the function argument comes before the default
  argument.
* Add `Maybe` class so one can do `Maybe(x).unwrap()`
  in addition to `unwrap(x)`, etc.
Copy link
Contributor

@melopeo melopeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add tests?



def or_(self: Optional[T], default: Optional[T]) -> Optional[T]:
if self is None:
def or_(val: Optional[T], default: Optional[T]) -> Optional[T]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a small docstring to this one as it is done for the other functions?

@jaheba
Copy link
Contributor Author

jaheba commented Jan 25, 2023

Can we add tests?

The docstrings are the tests.

melopeo
melopeo previously approved these changes Jan 25, 2023
@jaheba jaheba merged commit b38ab67 into awslabs:dev Jan 25, 2023
@jaheba jaheba deleted the rework-maybe branch January 25, 2023 19:37
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

Successfully merging this pull request may close these issues.

2 participants