Skip to content

Instantly share code, notes, and snippets.

@MapleCCC
Created January 6, 2022 10:28
Show Gist options
  • Save MapleCCC/31dabd67bb1e96723ecaaeba355a272d to your computer and use it in GitHub Desktop.
Save MapleCCC/31dabd67bb1e96723ecaaeba355a272d to your computer and use it in GitHub Desktop.
人类
class 人:
def __init__(self, name: str) -> None:
self.name = name
@property
def 名字(self) -> str:
return self.name
def 说话(self) -> None:
print("你好!")
person = 人(name="李阳")
print(person.名字) # "李阳"
person.说话() # "你好!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment