Metaclasses in Python: a couple of questions to clarify
05:44 03 Jul 2011

After crashing with metaclasses I delved into the topic of metaprogramming in Python and I have a couple of questions that are, imho, not clearly answered in available docs.

  1. When using both __new__ and __init__ in a metaclass, should their arguments be defined the same?
  2. What's most efficient way to define class __init__ in a metaclass?
  3. Is there any way to refer to class instance (normally self) in a metaclass?
python metaprogramming metaclass