LuckyKoala / TwodamBlogGittalk

For comments on twodam.net
0 stars 0 forks source link

Python学习笔记之定制类 | 笨熊之家 #56

Open LuckyKoala opened 5 years ago

LuckyKoala commented 5 years ago

https://twodam.net/customize-class-in-Python

1.实现一个较为完整的定制类,支持初始化,输出自定义实例、类对象信息,len()调用,for in,[],获取默认属性,以及调用instance():12345678910111213141516171819202122232425262728293031323334353637class Custom(object): slots = ('_name','index')