M
Marco Buttu
Hi all, I have a question about class creation and the __call__ method.
I have the following metaclass:
.... def __call__(metacls, name, bases, namespace):
.... print("FooMeta.__call__()")
From what I undestood, at the end of the class statement happens
something like this:
.... print("FooMeta.__call__()")
....
The call to the metaclass type causes the call to type.__call__(), so
that's happened is:
__call__})
Now I expected the output `FooMeta.__call__()` from the following Foo
class creation:
.... pass
because I thought at the end of the class Foo suite this should have
been happened:
FooMeta.__call__()
but I thought wrong:
.... def __call__(metacls, name, bases, namespace):
.... print("FooMeta.__call__()")
........ pass
....
How come? Is it because the first argument of metaclass.__call__() is
always type or I am thinking something wrong?
Thanks in advance, Marco
I have the following metaclass:
.... def __call__(metacls, name, bases, namespace):
.... print("FooMeta.__call__()")
From what I undestood, at the end of the class statement happens
something like this:
.... print("FooMeta.__call__()")
....
The call to the metaclass type causes the call to type.__call__(), so
that's happened is:
__call__})
Now I expected the output `FooMeta.__call__()` from the following Foo
class creation:
.... pass
because I thought at the end of the class Foo suite this should have
been happened:
FooMeta.__call__()
but I thought wrong:
.... def __call__(metacls, name, bases, namespace):
.... print("FooMeta.__call__()")
........ pass
....
How come? Is it because the first argument of metaclass.__call__() is
always type or I am thinking something wrong?
Thanks in advance, Marco