Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def some_class_decorator(class_: object):
- class ClassWrapper(class_):
- new_attr = 'foo'
- def __init__(self):
- super().__init__()
- self.another_new_attr = 'bar'
- return ClassWrapper
- @some_class_decorator
- class CustomType:
- some_attr = 1
- def __init__(self):
- self.another_attr = 2
- if __name__ == '__main__':
- some_var = CustomType()
- print(some_var.some_attr, some_var.another_attr,
- some_var.new_attr, some_var.another_new_attr, sep='\n')
Advertisement
Add Comment
Please, Sign In to add comment