Discuss / Python / 不用匿名函数的话user貌似的这样先定义

不用匿名函数的话user貌似的这样先定义

Topic source

class Chain(object): def init(self, path=''): self._path = path def user(self,name): return Chain('%s/%s' % (self._path, name)) def getattr(self, path): return Chain('%s/%s' % (self._path, path)) def str(self): return self._path repr = str print(Chain().status.user('jack').timeline.list)


  • 1

Reply