What is a non-deprecated way to do `new.classobj(name, (base_class,), my_dict)`

百般思念 提交于 2019-12-02 05:30:27

The type keyword is a class. You can perform the above using

module[name] = type(name, (base_class,), d)

This will return a class of name name with the tuple parameters of the base class base_class, initializing the member objects with the dict d.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!