<p class="codetitle"> 代码如下:</p> <p class="codebody" id="code21181"><br>def ReadOnlyObject(**args):<br> dictBI = {}<br> args_n = []<br> for name, val in args.items():<br> dictBI[name] = val<br> args_n.append(name)<br> dictBI['__slots__'] = args_n<br> return type('ReadOnlyObject', (object,), dictBI)()<br></p>