Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class_register = {}
- class Foo(object):
- def __init__(self, **kwargs):
- class_register[self.__class__.__name__] = ?? # what to store here?
- self.__dict__.update(kwargs)
- new_instance = class_register[result['class_name']](**result['data'])
- class_register[self.__class__.__name__] = self.__class__
- def register(cls):
- class_register[cls.__name__] = cls
- class Foo(object):
- # blah blah
- register(Foo)
- def register(cls):
- class_register[cls.__name__] = cls
- return cls
- @register
- class Foo(object):
- # blah blah
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement