def frozencopy(self): """ Return an immutable copy of the current settings. Alias for a :meth:`~freeze` call in the object returned by :meth:`copy`. """ copy = self.copy() copy.freeze() return copy
def frozencopy(self): """ Return an immutable copy of the current settings. Alias for a :meth:`~freeze` call in the object returned by :meth:`copy`. """ copy = self.copy() # 这是调用的self.copy(),是个深拷贝,直接拷贝一个setting的实例 copy.freeze() # 调用这个方法后,再调用setting实例的set方法会报警告,理解为不允许修改值即可 return copy
def frozencopy(self): copy = self.copy() copy.freeze() return copy