2
`typing.NamedTuple`サブクラスの` super`はPython 3.8で失敗します
Python 3.6では機能し、Python 3.8では失敗するコードがあります。次のように要約するとsuper、のサブクラスを呼び出すtyping.NamedTupleようになります。 <ipython-input-2-fea20b0178f3> in <module> ----> 1 class Test(typing.NamedTuple): 2 a: int 3 b: float 4 def __repr__(self): 5 return super(object, self).__repr__() RuntimeError: __class__ not set defining 'Test' as <class '__main__.Test'>. Was __classcell__ propagated to type.__new__? In [3]: class Test(typing.NamedTuple): ...: a: int ...: b: float ...: #def __repr__(self): …