Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PyMeta
#python 3.6.9 #PyMeta #this code is created by Rezaul Hoque on January 31,2022; #contact:jewelmrh@yahoo.com;Dhaka,Bangladesh;https://rezaulhoque.wordpress.com,https://hoquestake.blogspot.com #note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; class ExMetCls(type): """Example Metaclass""" def __new__(cls, clsnam, supcls, attrdict): return super(ExMetCls, cls).__new__(cls, clsnam, supcls, attrdict) def det(self): print('Example of Metaclass') A = ExMetCls('A', (object, ), {}) print('Type of class A:', type(A)) print(A.det()) class Another(object): def det(self): print("Example of type class") B= Another() print('Type of class Another:', type(B)) print(B.det()) class Both(A, Another): def det(self): print('Example of a class that inherits from type and Metaclass') C=Both() print('Type of class Both:', type(Both)) print(C.det())
run
|
edit
|
history
|
help
0
Skillenza- Subjects
Search by starting alphabets.
Infinite Fibonacci generator
Quick sort
lambda_filter_map_reduce.py
yield from example
Sending email from python
rstring
emoji replace
shuru6