class Foo: def __init__(self,name,age): self.name=name self.age=age def __getitem__(self,item): print('getitem') print(item) return self.__dict__.get(... ...
分类:
其他好文 时间:
2018-12-31 11:26:19
阅读次数:
158
type Config struct { Item lock } func (*Config) getItem(){ } func (*Config) SetItem(){ } channel : - timer - input - control ...
分类:
其他好文 时间:
2018-12-26 01:10:38
阅读次数:
126
window.localStorage: 体积5M,据说未来还会增大 生命周期,只要不清都在 设置:localStorage.setItem( ' key ' , ' value ‘ ) 获取:localStorage.getItem( ' key ' ) 删除:localStorage.remov ...
var token = localStorage.getItem("token"); $.ajaxSetup({ dataType: "json", cache: false, headers: { "token": token }, xhrFields: { withCredentials: tr... ...
分类:
Web程序 时间:
2018-12-07 12:11:57
阅读次数:
316
class Foo(): def __init__(self): print('init') def __call__(self,*args,**kwargs) print('call') def __getitem__(self,item): print(item) def __setitem__ ...
分类:
其他好文 时间:
2018-11-27 22:55:23
阅读次数:
263
前引 在了解flask上下文管理机制之前,先来一波必知必会的知识点。 面向对象双下方法 首先,先来聊一聊面向对象中的一些特殊的双下划线方法,比如__call__、__getattr__系列、__getitem__系列。 __call__ 这个方法相信大家并不陌生,在单例模式中,我们可能用到过,除此之 ...
分类:
其他好文 时间:
2018-11-27 19:40:40
阅读次数:
198
isinistance(obj, cls) 检查obj是否是类cls的对象 issubclass(sub,super) 检查sub类是否是super类的派生类 __setitem__,__getitem__,__delitem__ 把对象模拟成像字典对象操作一样的类型 __getitem__ 查看属 ...
分类:
其他好文 时间:
2018-11-26 00:17:27
阅读次数:
203
引子: 在了解flask上下文管理机制之前,先来一波必知必会的知识点。 一、面向对象双下方法 首先,先来聊一聊面向对象中的一些特殊的双下划线方法,比如__call__、__getattr__系列、__getitem__系列。 __call__ 这个方法相信大家并不陌生,在单例模式中,我们可能用到过, ...
分类:
其他好文 时间:
2018-11-25 22:27:54
阅读次数:
252
__setitem__ name alex__delitem__ sdfdsf ...
分类:
其他好文 时间:
2018-11-15 21:15:04
阅读次数:
158