包frozentype提供一些冻结的python类型(frozendict(基于c)和frozenmap(基于cython))
frozentype的Python项目详细描述
frozentype是MIT Licensedpython库。 它实现了一些冻结的python类型:frozendicttype(在c中)和FrozenDict,FrozenMapclasses(在cython中)。
- frozendict是只读的可散列字典(基于c)。
- frozenmap是环绕可变映射对象(基于cython)的只读映射对象。
- frozendict是只读的可哈希字典(基于cython)。
这个库实际上是为了证明快速frozendict(基于c/cython)的概念。
^{tt4}的主存储库$ 在bitbucket上。
快速入门:
首次装载库存:
>>> from frozentype import frozendict, FrozenDict
简单示例:
>>> fd = frozendict(a=1,b=2,c=3) >>> fd frozendict({'a': 1, 'b': 2, 'c': 3}) >>> fd['a'] 1 >>> fd['a'] = 10 ........ TypeError: 'frozentype._frozendict.frozendict' object does not support item assignment >>> del fd['a'] ......... TypeError: 'frozentype._frozendict.frozendict' object does not support item deletion >>> fd.pop('a') ......... AttributeError: 'frozentype._frozendict.frozendict' object has no attribute 'pop' >>> fd = FrozenDict(a=1,b=2,c=3) >>> print(fp) FrozenDict({'a': 1, 'b': 2, 'c': 3}) >>> fd['a'] 1 >>> fd['a'] = 10 ........ TypeError: 'frozentype.frozendict.FrozenDict' object does not support item assignment >>> del fd['a'] ......... TypeError: 'frozentype.frozendict.FrozenDict' object does not support item deletion >>> fd.pop('a') ......... AttributeError: 'frozentype.frozendict.FrozenDict' object has no attribute 'pop'
更改:
**0.6.0.1**(说服PYPI在自述文件中上传固定标题项目的技术版本)
**0.6**(从项目intellimath/frozenmap迁移)
- 为frozendict添加c实现。
- 为Frozendict类型添加测试。
0.5初始版本