我想问一下Python中的代码:
class UserDict:
def __init__(self, dict=None, **kwargs):
self.data = {}
if dict is not None:
self.update(dict)
if len(kwargs):
self.update(kwargs)
def clear(self): self.data.clear()
Run Code Online (Sandbox Code Playgroud)
这clear(self)
是一个UserDict
类的方法,并对类的data
属性进行操作,对吧?这个功能不会data
永远运作吗?因为它每次自称?