M
Matthew Wilson
I have been experimenting with metaclasses lately. It seems possible to
define a metaclass by either subclassing type and then either redefining
__init__ or __new__.
Here's the signature for __init__:
def __init__(cls, name, bases, d):
and here's __new__:
def __new__(meta, classname, bases, d):
Every metaclass I have found monkeys with d, which is available in both
methods. So when is it better to use one vs the other?
Thanks for the help.
Matt
define a metaclass by either subclassing type and then either redefining
__init__ or __new__.
Here's the signature for __init__:
def __init__(cls, name, bases, d):
and here's __new__:
def __new__(meta, classname, bases, d):
Every metaclass I have found monkeys with d, which is available in both
methods. So when is it better to use one vs the other?
Thanks for the help.
Matt