P
16 June 2025
S
当然Python没有内置Result类型,但你可以理解成带一些错误处理方法的Union[T, E]
S
除非你看文档给自己当人肉 type checker
17 June 2025
诶…总之 python 既然没有对返回异常的特别支持,用抛出异常我觉得完全 ok 呢
Z
业务上也没有任何理由说抛出异常不行,返回异常就可以
21 June 2025
Python 没必要通过返回值来区分是否有异常吧, 有 Exception 体系
try catch 起来, catch 里写异常处理逻辑
又不像 go 和 rust, 推荐使用返回值 err 和 Result 来区分
P
Z
S
X
S
A
J
会不会这么做 和 偏向于这么做 是两件事
A
22 June 2025
A
go/rust/c++不用异常是因为性能太差,python没这个问题
叫 panic,然后可以 unwind/recover
┗
P
┗
另外性能角度 panic 也未必会更差(相比于 result 和 err 返回值来说)
A snapshot of an open public feed from the search index
ChatCrawler — “Google for public Telegram”; refreshed as the venue is crawled.
Times are UTC.
Public content only, official Telegram API.
About ·
FAQ ·
What we do not do ·
Remove a page ·
Catalog