工具模块¶
用以提供全局通用工具方法&类
-
class
mohand.utils.
MohandDict
[源代码]¶ 基类:
dict
允许通过查找/赋值属性来操作键值的字典子类
举个栗子:
>>> m = MohandDict({'foo': 'bar'}) >>> m.foo 'bar' >>> m.foo = 'not bar' >>> m['foo'] 'not bar'
MohandDict
对象还提供了一个.first()
方法,起功能类似.get()
,但接受多个键名作为列表多参,并返回第一个命中的键名的值 再举个栗子:>>> m = MohandDict({'foo': 'bar', 'biz': 'baz'}) >>> m.first('wrong', 'incorrect', 'foo', 'biz') 'bar'
-
__weakref__
¶ list of weak references to the object (if defined)
-