Guest User

Untitled

a guest
Jan 24th, 2020
66
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class OneDigitNumericValue():
  2. def __init__(self, name):
  3. self.name = name
  4.  
  5. def __get__(self, instance, owner):
  6. if instance is None:
  7. return self
  8. return instance.__dict__[self.name]
  9.  
  10. def __set__(self, instance, value):
  11. instance.__dict__[self.name] = value
  12.  
  13. class A:
  14. name = OneDigitNumericValue("name")
  15.  
  16.  
  17. class OneDigitNumericValue():
  18. def __get__(self, instance, owner):
  19. if instance is None:
  20. return self
  21. return instance.__dict__[self]
  22.  
  23. def __set__(self, instance, value):
  24. instance.__dict__[self] = value
  25.  
  26. class A:
  27. name = OneDigitNumericValue()
RAW Paste Data