概要 今までPythonでコードを書くときに例外をなんとなく雰囲気で使っていたので、ちゃんと仕様を調べてみた。 検証したこと 1. Exceptionはコンストラクタ引数をargsフィールドに保持している 以下のようなコードを例にする。 def hoge(): raise Exception("hoge") try: hoge() except Exception as e: print(e.args) 実行すると以下のような結果になる。 $ python main.py ('hoge',) $次にExceptionの引数を以下のように変えて実行してみる。 raise Exception("hoge", "fuga") 実行すると以下のような結果になる。 $ python main.py ('hoge', 'fuga') $以上から、Exceptionはコンストラクタ引数をフィールドにTu