Provide custom type infomation : Class metaclass : Class PYTHON examples


PYTHON examples » Class » Class metaclass »

 

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 Scripts with Example Source Code in same category :

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Class
» Class metaclass


Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0