Discuss / Python / homework

homework

Topic source

gitKong

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

    def __getattr__(self, path):
        return Chain(self.__path + '/' + path)

    def __str__(self):
        return self.__path

    def __call__(self, value):
        return Chain(self.__path + '/' + value)

path = Chain().status.user('gitkong').passworld('123456')
print(path)

  • 1

Reply