Top "Metaclass" questions

In object-oriented programming, a metaclass is a class whose instances are classes.

How to read class attributes in the same order as declared?

I am writing a metaclass that reads class attributes and store them in a list, but I want the list (…

python class metaclass
Metaclass Mixin or Chaining?

Is it possible to chain metaclasses? I have class Model which uses __metaclass__=ModelBase to process its namespace dict. I'm …

python metaclass
__metaclass__ in Python 3

In Python2.7 this code can work very well, __getattr__ in MetaTable will run. But in Python 3 it doesn't work. class …

python metaclass
How to pass arguments to the metaclass from the class definition?

I'm trying to dynamically generate classes in python 2.7, and am wondering if you can easily pass arguments to the metaclass …

python metaprogramming python-2.x metaclass
Dynamically define named classes in Ruby

I am writing an internal DSL in Ruby. For this, I need to programmatically create named classes and nested classes. …

ruby metaprogramming dsl metaclass
Is there any reason to choose __new__ over __init__ when defining a metaclass?

I've always set up metaclasses something like this: class SomeMetaClass(type): def __new__(cls, name, bases, dict): #do stuff here …

python constructor new-operator metaclass init
Add method to metaclass

I'm just playing with the metaclass programming in Groovy. But suddenly I was facing a little problem which I just …

methods groovy metaprogramming metaclass
Java implementation - Meta classes

The way I understand it, Java object model is 3 levels, each level describes the level beneath it, therefore there is …

java metaclass
python subclasscheck & subclasshook

The methods __subclasscheck__ and __subclasshook__ are used to determine if a class is regarded as subclass of another. However, their …

python python-3.x abstract-class metaclass
Python ABC Multiple Inheritance

I think the code will explain the problem better than I can do with words. Here is the code in …

python python-2.7 multiple-inheritance metaclass urwid