Last active
January 6, 2022 14:34
-
-
Save MapleCCC/b164ac9faacfaca3d20a904a76bd8a44 to your computer and use it in GitHub Desktop.
默僧类
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 修会(Enum): | |
本笃会 = "Benedictines" | |
熙笃会 = "Cistercians" | |
严规熙笃隐修会 = "Trappists" | |
class 默僧(人): | |
def __init__(self, name: str, order: 修会) -> None: | |
super().__init__(name) | |
self.order = order | |
@property | |
def 所奉修会(self) -> 修会: | |
return self.order | |
def 修行(self) -> None: | |
# some syscall code that yield side effects | |
monk = 默僧(name="李阳", order=修会.熙笃会) | |
print(monk.名字) # "李阳" | |
print(monk.所奉修会) # 修会.熙笃会 | |
monk.说话() # "你好!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment