Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ComplicatedNamespace:
- ACCEPTED_VALUES = ("id_", "user", "location")
- @classmethod
- def init_with_data(cls, **data):
- instance = cls()
- for key, value in data.items():
- if key in cls.ACCEPTED_VALUES:
- setattr(instance, key, value)
- return instance
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement