Skip to content

Instantly share code, notes, and snippets.

@MapleCCC
Last active January 6, 2022 14:34
Show Gist options
  • Save MapleCCC/b164ac9faacfaca3d20a904a76bd8a44 to your computer and use it in GitHub Desktop.
Save MapleCCC/b164ac9faacfaca3d20a904a76bd8a44 to your computer and use it in GitHub Desktop.
默僧类
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