Created
June 8, 2018 15:48
-
-
Save acwoss/845671bdb975fd567c0d8ee3f2f607be to your computer and use it in GitHub Desktop.
ShinyHorizontalDesigners created by acwoss - https://repl.it/@acwoss/ShinyHorizontalDesigners
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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