我写了这样的代码,它们都适合我,但有什么区别?哪个更好?
class Demo1(object):
def __init__(self):
self.attr = self._make_attr()
def _make_attr(self):
#skip...
return attr
class Demo2(object):
def __init__(self):
self.attr = self._make_attr()
@staticmethod
def _make_attr():
#skip...
return attr