Python sys.intern()
本帖最后由 一个账号 于 2020-3-21 15:52 编辑Python sys.intern()
>>> import sys
>>> sys.intern("qwe")
'qwe'
>>> a = sys.intern("qwe")
>>> a
'qwe'
你们觉得这个东西有什么用呢?
官方文档是这么写的:
intern(string, /)
``Intern'' the given string.
This enters the string in the (global) table of interned strings whose
purpose is to speed up dictionary lookups. Return the string itself or
the previously interned string object with the same value. @一个账号 @zltzlt @_2_ @wuqramy qiuyouzhi 发表于 2020-3-21 16:00
@一个账号 @zltzlt @_2_ @wuqramy
https://fishc.com.cn/thread-158679-1-1.html @_2_ 加个好友 一个账号 发表于 2020-3-21 16:00
https://fishc.com.cn/thread-158679-1-1.html
可以举个例子吗?
比如intern的实际用途? qiuyouzhi 发表于 2020-3-21 16:03
可以举个例子吗?
比如intern的实际用途?
不是写了吗:为了提高字符串使用的效率和使用性能 呵呵 我也不了解
页:
[1]