摘要: 什么是元类 模拟class关键字创建类的过程:类被创建的2种方法 自定制一个元类,让它必需具有注释 创建元类的具体过程 阅读全文
posted @ 2017-09-13 20:34 Adamanter 阅读(98) 评论(0) 推荐(0) 编辑
摘要: with 语句 阅读全文
posted @ 2017-09-13 20:28 Adamanter 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 类的使用本质是调用类的内置方法 __getitem__, __setitem__,__delitem__,__delattr__ # 内置方法:__slots__ #实现迭代器协议的内置方法:__iter__,__next__ # 实现range类,__next__进行StopIteration处理 阅读全文
posted @ 2017-09-13 20:16 Adamanter 阅读(127) 评论(0) 推荐(0) 编辑
摘要: l=[1,2,3,4,"h","h","l",(1,2,3),[1,2,3]] x=0 y=0 z=0 m=0 for i in l: if isinstance(i,str): x+=1 elif isinstance(i,int): y+=1 elif isinstance(i,tuple): z+=1 el... 阅读全文
posted @ 2017-09-13 20:03 Adamanter 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 包装和授权 举个例子 # 练习一:重写自定制列表的append和insert方法 # 练习二:根据需求自定制列表 练习三:权限与列表 阅读全文
posted @ 2017-09-13 19:58 Adamanter 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 类的内置方法:__getattr__,__setattr__,__delattr__ python面向对象中的反射:hasattr,getattr,setattr,delattr 基于模块的反射 重写自定制列表的append和insert方法 阅读全文
posted @ 2017-09-13 19:23 Adamanter 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 类和对象的绑定和解除绑定 @classmethod 装饰器 @staticmethod 装饰器 @property装饰器 @方法名.setter/@方法名.deleter 总结回答 阅读全文
posted @ 2017-09-13 15:17 Adamanter 阅读(272) 评论(0) 推荐(0) 编辑
摘要: 经典类和新式类的区别: 经典类就是经典就是旧式类,过去了就经典了,呵。 阅读全文
posted @ 2017-09-13 11:47 Adamanter 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 什么是orm orm的技术特点 orm的优缺点 阅读全文
posted @ 2017-09-13 09:55 Adamanter 阅读(229) 评论(0) 推荐(0) 编辑