使用SessionWizardView,我想声明示例变量,在步骤之间持久化。但是,当使用时,它们不是持久的:第一个月
pengsaosao1#
class YourClass: class_variable = None def __init__(self): if YourClass.class_variable is None: YourClass.class_variable = "default value" self.instance_variable = YourClass.class_variable instance1 = YourClass() print("instance1>>",instance1.variable) instance2 = YourClass() print("instance2>>",instance2.variable)
个字符
1条答案
按热度按时间pengsaosao1#
个字符