Python metaclass 'nmspc' what does it mean?

155 views Asked by At

I've seen 'nmspc' being used in the __init__ and __new__ methods of a metaclass in Python. What does 'nmspc' stand for?

class SimpleMeta1(type):
    def __init__(cls, name, bases, nmspc):
        super(SimpleMeta1, cls).__init__(name, bases, nmspc)
        cls.uses_metaclass = lambda self : "Yes!"
1

There are 1 answers

0
Daniel On

The arguments of __init__ and __new__ are the same as the parameters of the type function:

type(name, bases, dict) -> a new type

where the third parameter contains a dictionary with all methods or class variables defined inside the class-Block. As this is the "Namespace" of the class, someone might name it nmspc, for me, a name should be clear to the reader, so some vowels would be nice.