Provide custom type infomation : Class metaclass « Class « Python






Provide custom type infomation

Provide custom type infomation
       
class MyMeta(type):
    def __str__(cls): 
       return "Class name is '%s'"%cls.__name__

class MyClass:
    __metaclass__ = MyMeta

x = MyClass()

print type(x)


           
       








Related examples in the same category