用于增量内存映射的库
ScenicOverlook的Python项目详细描述
风景远眺图书馆包含用于增量 地图减少。
这些数据结构被实现为树,并存储在每个节点上, reduce的中间值。这意味着当你切片或合并 结构,可以有效地计算映射/归约的新输出。 (通过重用树中未更改部分的旧输出)
典型用法如下:
#!/usr/bin/env python from scenicoverlook import viewablelist space_concat = lambda x, y: x + ' ' + y l = viewablelist(['the', 'quick', 'brown', 'fox']) print l.reduce(space_concat) # This yields 'the quick stealthy brown fox', reusing cached intermediate # substrings from the earlier call like 'the quick' and 'brown fox': print (l[:2] + ['stealthy'] + l[2:]).reduce(space_concat)
有关更多示例,请参见pydocs:
https://github.com/pschanely/ScenicOverlook/blob/master/scenicoverlook/__init__.py