Python 組み込み関数 vars
https://docs.python.org/ja/3/library/functions.html#vars
モジュール、クラス、インスタンス、あるいはそれ以外の __dict__ 属性を持つオブジェクトの、 __dict__ 属性を返します。
モジュールやインスタンスのようなオブジェクトは、更新可能な __dict__ 属性を持っています。ただし、それ以外のオブジェクトでは __dict__ 属性への書き込みが制限されている場合があります。
書き込みに制限がある例としては、辞書を直接更新されることを防ぐために types.MappingProxyType を使っているクラスがあります。
Python types.MappingProxyType
A TypeError exception is raised if an object is specified but it doesn't have a __dict__ attribute (for example, if its class defines the __slots__ attribute).
クラスは__slots__属性からも作れるらしい
__slots__ (Python データモデル)