Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. class ComplicatedNamespace:
  2. ACCEPTED_VALUES = ("id_", "user", "location")
  3.  
  4. @classmethod
  5. def init_with_data(cls, **data):
  6. instance = cls()
  7. for key, value in data.items():
  8. if key in cls.ACCEPTED_VALUES:
  9. setattr(instance, key, value)
  10. return instance
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement