重写 dict get() 方法

class Local(dict):

    def get(self, key):
        try:
            return dict(self[key])
        except KeyError:
            raise exceptions.ResourceError("no such user")


local = Local()

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/Enjolras_fuu/article/details/88399662