This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Pythonのクラスはすべて`type`のインスタンスであり、クラス定義時に`type`が呼び出される `type`をサブクラス化(メタクラス)することで、クラス生成の仕組みを自由に拡張できる Pythonのクラスシステムは、見た目以上に多くの仕組みが存在します。一般的に ...
prepare メソッドを使うと、クラスの辞書(namespace)をカスタマイズしたり、独自の辞書型を返せるため、クラス定義時の属性収集方法を柔軟に制御できる。 メタクラスの call は、クラスがインスタンス化される際の流れ(new → init)を総括し、クラス自身を ...
Python supports metaprogramming, which allows you to write code that manipulates other code. Two key features of metaprogramming in Python are **decorators** and **metaclasses**. ## **1. Decorators** ...