Skip to content

Instantly share code, notes, and snippets.

@acwoss
Created June 8, 2018 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acwoss/845671bdb975fd567c0d8ee3f2f607be to your computer and use it in GitHub Desktop.
Save acwoss/845671bdb975fd567c0d8ee3f2f607be to your computer and use it in GitHub Desktop.
ShinyHorizontalDesigners created by acwoss - https://repl.it/@acwoss/ShinyHorizontalDesigners
class Pessoa:
@property
def idade(self):
return self._idade
@idade.setter
def idade(self, value):
if value < 0:
raise ValueError('Idade não pode ser negativa')
self._idade = value
p = Pessoa()
p.idade = 30
print(p.idade)
p.idade = -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment