fork download
  1. class Fred:
  2. def __init__(self):
  3. self.name = 1
  4.  
  5. @property
  6. def name(self):
  7. return self._name
  8.  
  9. @name.setter
  10. def name(self, value):
  11. if isinstance(value, int): raise Exception("No ints allowed.")
  12. self._name = value
  13.  
  14. x = Fred()
Runtime error #stdin #stdout #stderr 0.01s 27704KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 14, in <module>
  File "./prog.py", line 3, in __init__
  File "./prog.py", line 11, in name
Exception: No ints allowed.