What is the concept of metaclass in Python for type?

2026-05-24 13:350阅读0评论SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计44个文字,预计阅读时间需要1分钟。

What is the concept of metaclass in Python for type?

obj=Foo()

What is the concept of metaclass in Python for type?

obj=Foo()##Foo类是MyType类的对象 所以先执行MyType的init Foo()加括号执行MyType的call

foo=type('Foo',(object,),{'say':lambda a:123}) ##所有类都是type类的对象 print(foo().say())