Discuss / Python / 试试

试试

Topic source

class Chain(): def init(self,path=''): self._path = path

def users(self,name):
    self.name = name
    return Chain('%s/%s' % (self._path, self.name))

def __getattr__(self,path):
    return Chain('%s/%s' % (self._path,path))

def __str__(self):
    return self._path

__repr__ = __str__

  • 1

Reply