pythonでもdictに型を付けたいですね。一応TypedDictという型を定義したいという動きになっています。ちなみにまだこの機能はexperimentalになっているので。mypy_extensionsの方に入っています。 import mypy_extensions as mx class Pair(mx.TypedDict): left: int right: int d0: Pair = {"left": 0, "right": 0} # もしくは d1 = {"left": 0, "right": 0} # type: Pai mypy_extensions ついでに寄り道、mypy_extensionsについて、基本的にpythonの型関連の機能は以下の順でnitghtlyからstableというような遷移をします。 mypy_extensions -- experiment