python中一切皆为对象,且python3中类与类型是一个概念,类型就是类
# 类型dict就是类dict
>>> list
<class 'list'>
# 实例化的到3个对象l1,l2,l3
>>> l1=list()
>>> l2=list()
>>> l3=list()
# 三个对象都有绑定方法append,是相同的功能,但内存地址不同
>>> l1.append
<built-in method append of list object at 0x10b482b48>
>>> l2.append
<built-in method append of list object at 0x10b482b88>
>>> l3.append
<built-in method append of list object at 0x10b482bc8>
# 操作绑定方法l1.append(3),就是在往l1添加3,绝对不会将3添加到l2或l3
>>> l1.append(3)
>>> l1
[3]
>>> l2
[]
>>> l3
[]
# 调用类list.append(l3,111)等同于l3.append(111)
>>> list.append(l3,111) #l3.append(111)
>>> l3
[111]
class MufengStudent:
school = 'mufeng'
def learn(self):
print('is learning')
def eat(self):
print('is sleeping')
print(MufengStudent) # <class '__main__.MufengStudent'>