center', 'count', 'decode', 'encode','endswith', 'expandtabs', 'find', 'format', 'index', 'isalnum', 'isalpha...Python中都是有特殊用途的,比如__len__方法返回长度。...在Python中,如果你调用len()函数试图获取一个对象的长度,实际上,在len()函数内部,它自动去调用该对象的__len__()方法,所以,下面的代码是等价的:
>>> len('ABC')
3...line 1, in
AttributeError: 'Student' object has no attribute'score'
由于'score'没有被放到__slots__中...,所以不能绑定score属性,试图绑定score将得到AttributeError的错误。