Feature proposal: `raise`/`throws` function
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.2k
- Forks
- 280
- Avg merge
- 6d 17h
- Merged PRs (30d)
- 4
Description
Given lambda's lack of complexity, it may me surprising to learn that you can't raise an exception directly. However, it is possible to create a function that receives an exception and throws it, like so:
from toolz.functoolz import excepts
def throw(exception: Exception) -> Any:
raise exception
validation_list = ['10', '20', '30', 'invalid']
validated_list = map(excepts(ValueError, int, lambda _: throw(ValidationError(...)), validation_list)
I believe this is a good candidate for inclusion on the functoolz module. What do you think?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the functoolz module and its existing exception-related helpers. Determine the intended public API and behavior for a raise/throws function, then add coverage for the agreed behavior; the issue does not name a source file or test location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100