-
-
Notifications
You must be signed in to change notification settings - Fork 8
Decide whether split(..., None) should return (None, None) #7
Comments
Here is my understanding of caught, rest = split(.., .., ..)
handle(caught) If Assume that my thought is right :) I think there are two ways to handle in the
I would suggest the 2nd approach... The 1st approach seems fine at glance, but we will have an error when we are coding like this: caught, rest = split(.., None, ..) If we pick this approach, we have to use |
Yeah, I can't think of any cases where we would want to pass @contextmanager
def simplified_catch(exc_type, handler):
try:
yield
except BaseException as exc:
caught, rest = split(exc_type, exc)
... So it should never encounter a situation where |
What about introducing type annotation here? def split(exc_type: Type[BaseException], exc: BaseException, *, match: Optional[Callable] = None) -> Tuple[BaseException, BaseException]: From the defininition, we don't need to check if the |
Fixed in #10 |
That's what it does right now. Is there any good reason for this?
MultiError.filter
passed throughNone
, butMultiError.filter
had a more general system where handlers took exceptions as arguments, and returned new exceptions as return values, and could returnNone
to mean "this exception has been successfully handled, no exception replaces it", and that's gone in the new design.The text was updated successfully, but these errors were encountered: