将代理列表转换为返回列表的函数
项目描述
此小型包提供将代理列表转换为返回列表的函数的功能
>>> from lazylist import LazyList >>> l = LazyList(lambda: x) >>> x = [1, 2, 3] >>> list(l) [1, 2, 3]
更确切地说,视图函数不需要返回一个精确的 list,而是一个任何序列对象,例如 str、tuple
>>> x = "hello" >>> list(l) ['h', 'e', 'l', 'l', 'o']
它满足 collections.abc.Sequence 协议
>>> from collections import Sequence >>> isinstance(l, Sequence) True >>> l[-1] 'o' >>> len(l) 5
但是,它不满足 collections.abc.MutableSequence 协议。换句话说,它是不可变的
>>> from collections import MutableSequence >>> isinstance(l, MutableSequence) False >>> l[0] = 'H' Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'LazyList' object does not support item assignment
在LGPLv3或更高版本下分发。
待办事项
LazySet
LazyMap
关闭
lazylist-0.9.0.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 7bb960f2d39d0e6b274d65738bad3147721906298b1dbe7561158261666c2caa |
|
MD5 | 411aa103ffb87805b379fde62a6a8bf3 |
|
BLAKE2b-256 | 3c6584cb36de68ab72059fca33016125cb6a2c1963817e42d0b04643bab21814 |
关闭
lazylist-0.9.0-py2.py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | a04be55176997956387e0705823d822e0031a5d787fb1e792787ed1fd07f5ba6 |
|
MD5 | bc2de977e2ae67f4e5a4ea21f18d9991 |
|
BLAKE2b-256 | 75ebdc3c807c2d0638898b3f57d2f57d3c044876ba6548cb66be488d1b0bbee3 |