We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
Is there any better way achieving this?
from pampy import match, _ test_items = [5, '5', [5], 'not a digit'] for x in test_items: result = match(x, str, lambda x: match(x, str.isdigit, lambda x: int(x), _, 0 ), int, x, _, 0 ) print(f'{x} ({type(x).__name__}) -> {result}')
It is hard to describe what we want to achieve in words, but it's easy to see by example:
5 -> 5 '5' -> 5 'not a digit' -> 0 [1] -> 0
It looks over-complicated.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
Is there any better way achieving this?
It is hard to describe what we want to achieve in words, but it's easy to see by example:
It looks over-complicated.
The text was updated successfully, but these errors were encountered: