DEV Community

Discussion on: Python exceptions considered an anti-pattern

Collapse
 
sobolevn profile image
Nikita Sobolev

Well, @pipeline actually had multiple problems. And it is now removed from dry-python.
It is actually imperative compared to declarative function composition. Why so? Because @pipeline is an partial implementation of do-notation, which is imperative by definition.

But. The difference is still visible.

  1. Now exceptions can be visible in the funtion's signatire (let's use the same example from your post, even knowing that @pipeline is removed):
@pipeline
def grand_pipeline() -> Result[ValueType, ExceptionType]:
    parent_pipeline().unwrap()
Enter fullscreen mode Exit fullscreen mode

Here it is! We know that something happens! And we can express it with types.

  1. We have a special feature to enable stacktraces for your Results in development. See returns.readthedocs.io/en/latest/p...