Changes between Version 1 and Version 2 of Ticket #21681, comment 5


Ignore:
Timestamp:
10/11/16 15:52:26 (5 years ago)
Author:
SimonKing
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #21681, comment 5

    v1 v2  
    66!SageMetaclass defines a `__call__` method for its instances (thus overriding `type.__call__`). When such instance is used as a metaclass when defining a class, then the metaclass' `__call__` method inspects the bases of the to-be-created class and dynamically creates (if necessary) a common sub-class of the metaclasses of the bases. Eventually, the class is created as an instance of the common (dynamic) metaclass. And python will be happy, because the metaclass of the new class is a sub-class of the metaclasses of the given bases.
    77
    8 Both in Python 2 and in Python 3, the metaclass is called during creation of a class (which is were all magic happens). That's why I think it should work on Python 3 as well.
     8Both in Python 2 and in Python 3, the metaclass is called during creation of a class (which is where all magic happens). That's why I think it should work on Python 3 as well.