dry-python / dry-python/returns

IOSuccess / IOFailure and match-case

オープン
#2,355 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
4.4k
フォーク
155
平均マージ
2時間 27分
マージ済み PR(30日)
22

説明

I don't really see the point of `IOSuccess` and `IOFailure`. From one hand, `IOResult.from_value(1) == IOSuccess.from_value(1)`. Actually ,`IOSuccess.from_value(1) == IOFailure.from_value(1)`.
I would also expect some benefit when using it in a match-case. Something like:

```python
value = IOSuccess.from_value(1)
match value:
case IOSuccess(v): assert(v == 1)
case _: pass
```

However, the "correct" code is

```python
value = IOSuccess.from_value(1)
match value:
case IOResult(Success(v)): assert(v == 1)
case _: pass
```

Therefore, `IOSuccess` and `IOFailure` as aliases are quite confusing. Don't you think?

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。