Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
FinancialMagnificentBracket created by acwoss - https://repl.it/@acwoss/FinancialMagnificentBracket
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
You can’t perform that action at this time.