我在问一个非常基本的问题。
我查阅了dict
的文件如下:
In [1]: ?dict
Init signature: dict(self, /, *args, **kwargs)
Docstring:
dict() -> new empty dictionary
dict(mapping) -> new dictionary initialized from a mapping object's
(key, value) pairs
dict(iterable) -> new dictionary initialized as if via:
d = {}
for k, v in iterable:
d[k] = v
dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
Type: type
Subclasses: OrderedDict, defaultdict, Counter, _EnumDict, Bunch, Config, Struct, ColorSchemeTable, FastDictCache, _CharSizesCache, ...
上面我知道了dict
有哪些子类。我使用了OrderedDict
、defaultdict
、Counter
、Bunch
,但是我在FastDictCache
上找不到任何在线资源
python中的FastDictCache
是什么?哪个包裹里有?如何使用它
正如评论所说:
cls.__subclasses__()
:FastDictCache
来自python-prompt-toolkit
:https://github.com/prompt-toolkit/python-prompt-toolkit/blob/master/prompt_toolkit/cache.py#L63get_value
可调用并像dict一样访问它来使用它,但是从实现来看,内置的^{相关问题 更多 >
编程相关推荐