Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work. Try for free Learn more
デフォルト引数周りの型のことでちょっと把握できなかった部分があったのでメモ。 余分なデフォルト引数を持つ実装について 例えば、以下の様なプロトコルがあるとする。 import typing as t import typing_extensions as tx class Adder(tx.Protocol): def add(self, x: int, y: int) -> int: ... このAdder.addメソッドはデフォルト引数を持たない。一方で、デフォルト引数を持つような実装はこのプロトコルの制約を満たすのかということが気になる。 例えば以下のようなもの class A: def add(self, x: int, y: int, *, verbose: bool = False) -> int: return x + y class B: def add(self, x:
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く