Skip to content

Instantly share code, notes, and snippets.

@pavlenko-volodymyr
Last active September 16, 2020 13:15
Show Gist options
  • Select an option

  • Save pavlenko-volodymyr/a9592b298b04f1963b29f3a3ef17f5e9 to your computer and use it in GitHub Desktop.

Select an option

Save pavlenko-volodymyr/a9592b298b04f1963b29f3a3ef17f5e9 to your computer and use it in GitHub Desktop.
def min_marriage_age(age):
pass
@min_marriage_age(22)
class Person:
first_name: str
last_name: str
age: int
min_age: int
john = Person("John", "Smith", 18)
lili = Person("Lili", "Dou", 18)
assert john.first_name == "John"
assert john.last_name == "Smith"
assert john.age == 18
assert lili.first_name == "Lili"
assert lili.last_name == "Dou"
assert lili.age == 18
married = john + lili
assert not married
john.age = 21
assert john.age == 21
john.age = 17
assert john.age == 21
john.age = 22
lili.age = 22
married = john + lili
assert married
assert lili.last_name == "Smith"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment