この記事はPython Advent Calendar 2020 の7日目の記事です。 今年の PyConJP 2020 では、Python の型ヒントについて登壇させていただきました。 speakerdeck.com 2020 年も終わりかけですから、「もう 2021 年からは Python のデフォルト引数に list 入れてもよくないか?」という提案をしてみたいと思います。 Python のデフォルト引数のアンチパターン Python は引数にデフォルト値(デフォルト引数)を指定することができます。 def generate_zero(x=0): return x zero = generate_zero() print(zero) # 0 print(zero + 1) # 1 print(generate_zero()) # 0 当たり前のように、デフォルト引数に指定した 0 と