Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class A(type):
- def __setattr__(self, name, value):
- print("From metaclass: ", name)
- class B(metaclass= A):
- def __init__(self): pass
- def __setattr__(self, name, value):
- print("From B: ", name)
- object.__setattr__(self, name, value)
- obj = B()
- obj.t = 4
- print("Value of t is set and it is: ", obj.t)
- B.r = 3 #<--- how to initialize this?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement