Can Python#39;s set absence of ordering be considered random order?(Python 设置的无序是否可以被视为随机序?)
问题描述
我想知道 Python 内置 set 结构中缺少元素排序是否足够随机".例如,取一个集合的迭代器,是否可以将其视为其元素的混洗视图?
I'd like to know if the absence of element ordering of the Python's built-in set structure is "random enough". For instance, taking the iterator of a set, can it be considered a shuffled view of its elements?
(如果重要的话,我在 Windows 主机上运行 Python 2.6.5.)
(If it matters, I'm running Python 2.6.5 on a Windows host.)
推荐答案
不,它不是随机的.它是任意排序的",这意味着您不能依赖它是有序的还是随机的.
No, it is not random. It is "arbitrarily ordered", which means that you cannot depend on it being either ordered or random.
这篇关于Python 设置的无序是否可以被视为随机序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Python 设置的无序是否可以被视为随机序?
基础教程推荐
- 与常规 dict 相比,Python manager.dict() 非常慢 2022-01-01
- Discord.py 缺少必需的参数 2022-01-01
- numpy float:比算术运算中内置的慢 10 倍? 2022-01-01
- 使用生成器和迭代器时 Python 多循环失败 2022-01-01
- 将 x 轴刻度更改为自定义字符串 2022-01-01
- 用 Python 编写 Fortran 无格式文件 2022-01-01
- 由Python将MP3转换为MIDI(类型错误:无法加载插件:mtg-Melodia:Melodia) 2022-01-01
- pyserial - 可以从线程 a 写入串行端口,是否阻塞从线程 b 读取? 2022-01-01
- 尝试制作WhatsApp机器人 2022-01-01
- 在 Celery 工作人员中捕获 Heroku SIGTERM 以优雅地关 2022-01-01
