3 ms·
I find metaclasses philosophically unsound. If one introduces metaclasses, what about meta-metaclasses, meta-meta-metaclasses. In this regard Self's prototypica
by lang 15y ago
I find metaclasses philosophically unsound. If one introduces metaclasses, what about meta-metaclasses, meta-meta-metaclasses. In this regard Self's prototypical oop seems more coherent - there are only objects. Even object/class duality looks philosophically more attractive than object/class/metaclass trio.
- lloeki 15y agometa is all relative and means 'beyond'. A metaclass being a class, it can itself have a metaclass, and so on, and they are all only objects, where the author's following excerpt embodies: MyClass = MetaClass() MyObject = MyClass() Those two code blocks are effectively equivalent: class Quux(type): #__metaclass__ = type is implicit pass class Qux(object): __metaclass__ = Quux pass and: Quux = type('Quux', (type,), {}) Qux = Quux('Qux', (object,), {}) the __metaclass__ attribute merely puts in words what's the callable being called when the keyword class gets parsed and subsequently handled in the current namespace. This class/object unification is one of a bunch of unifications I find extremely satisfying when thinking about how Python ticks.