本文整理汇总了Python中future.types.issubset方法的典型用法代码示例。如果您正苦于以下问题:Python types.issubset方法的具体用法?Python types.issubset怎么用?Python types.issubset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类future.types
的用法示例。
在下文中一共展示了types.issubset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __contains__
# 需要导入模块: from future import types [as 别名]
# 或者: from future.types import issubset [as 别名]
def __contains__(self, key):
errmsg = "'in <string>' requires string as left operand, not {0}"
# Don't use isinstance() here because we only want to catch
# newstr, not Python 2 unicode:
if type(key) == newstr:
newkey = key
elif isinstance(key, unicode) or isinstance(key, bytes) and not isnewbytes(key):
newkey = newstr(key)
else:
raise TypeError(errmsg.format(type(key)))
return issubset(list(newkey), list(self))
示例2: __contains__
# 需要导入模块: from future import types [as 别名]
# 或者: from future.types import issubset [as 别名]
def __contains__(self, key):
if isinstance(key, int):
newbyteskey = newbytes([key])
# Don't use isinstance() here because we only want to catch
# newbytes, not Python 2 str:
elif type(key) == newbytes:
newbyteskey = key
else:
newbyteskey = newbytes(key)
return issubset(list(newbyteskey), list(self))