I want to set the initial state dynamically, like this:
def __init__(self, state): self.current_state=state
but this will give the error "cant't set the attribute"
来自Sakis Kasampalis 所著的 Mastering Python Design Patterns,该书由夏永峰翻译为简体中文。
screenshot form Mastering Python Design Patterns by Sakis Kasampalis, and its translated to simplified-chinese by Yongfeng Xia.
I want to set the initial state dynamically, like this:
def __init__(self, state): self.current_state=state
but this will give the error "cant't set the attribute"