python面试题08 python中的类 元类 对象

Python 中一切皆为对象(Everything in Python is an object);
Python 是一种面向对象编程(Object Oriented Programming, OOP)的语言。

Python中的一切都是对象,无论是int,字符串,函数还是类。

对象分为两类,实例对象和类对象。类对象就是类。
(权威的说法metaclasses,classes,instance三类对象)

我们可以这么理解,类实例化是实例对象,元类实例化就是类。

type是python内置的唯一元类。当然你可以自己开发元类。int str等则是python内置的类。一切类都是元类的实例化,包括元类自己。

拓展

https://www.cnblogs.com/zuoshoushizi/p/7600145.html

https://www.cnblogs.com/tkqasn/p/6524879.html

https://blog.csdn.net/define_us/article/details/78556617

猜你喜欢

转载自blog.csdn.net/weixin_41853490/article/details/81261083
今日推荐