好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

python创建只读属性对象的方法(ReadOnlyObject)

代码如下:


def ReadOnlyObject(**args):
dictBI = {}
args_n = []
for name, val in args.items():
dictBI[name] = val
args_n.append(name)
dictBI['__slots__'] = args_n
return type('ReadOnlyObject', (object,), dictBI)()

查看更多关于python创建只读属性对象的方法(ReadOnlyObject)的详细内容...

  阅读:39次