Discuss / Python / 交作业

交作业

Topic source

狗不理翔

#1 Created at ... [Delete] [Delete and Lock User]
class Chain(object):
    def __init__(self,path=''):
        self._path=path

    def __getattr__(self,path):
        if path=='users':
            return lambda x:Chain('%s/%s/%s'%(self._path,path,x))
        return Chain('%s/%s'%(self._path,path))

    def __str__(self):
        return self._path

  • 1

Reply