Skip to content

Instantly share code, notes, and snippets.

@kenoss
Last active August 10, 2021 08:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenoss/b0a8ef5171ef480d99a1adf271b6b4a6 to your computer and use it in GitHub Desktop.
Save kenoss/b0a8ef5171ef480d99a1adf271b6b4a6 to your computer and use it in GitHub Desktop.
A poet on exception in python

元々の話題: python 初学者にオススメできる例外についての知見あれば

まとめ

  • Python やめた方がよいよ.
  • どうしても使わざるを得ない場合はドキュメントをちゃんと読んで最低限 pythonic way に従うのがよいよ.
  • 自分でエラーを送出する場合は golang っぽくやるのがよいよ.

https://github.com/dbrgn/result/blob/v0.6.0/result/result.py#L22

$ poetry run python
Python 3.8.2 (default, Apr 20 2020, 09:12:58)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from result import Ok
>>> Ok()
Ok(True)

静的型付き言語書いたことある???

Footnotes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment