dry-python / dry-python/returns
IOSuccess / IOFailure and match-case
- 主要語言
- Python
- 星號
- 4.4k
- 分支
- 155
- 平均合併
- 2 小時 27 分鐘
- 30 天內合併 PR
- 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?
貢獻指南
研究方向
先找出 IOSuccess、IOFailure、IOResult 和 Success 的定義,接著重現 issue 中的兩個 match-case 範例與相等比較。預期行為以及是否應變更這些別名在此處尚未決定,因此要完成這項工作,需要一個已達成共識的設計及相應的測試。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- tooling
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 25/100