Created
June 8, 2018 15:56
FinancialMagnificentBracket created by acwoss - https://repl.it/@acwoss/FinancialMagnificentBracket
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 Idade(object): | |
def __init__(self, value=None): | |
self.value = value | |
def __get__(self, obj, objtype): | |
return self.value | |
def __set__(self, obj, val): | |
if val < 0: | |
raise ValueError | |
self.value = val | |
class Pessoa(object): | |
idade = Idade(30) | |
m = Pessoa() | |
m.idade = -3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment