在Python中,如何确定可迭代对象是否具有稳定的迭代顺序?
有collections.Iterable抽象的基类,但没有稳定的对应类。
collections.Iterable
我问的原因是为了能够防止用户或不稳定的迭代顺序(警告他们,当他们通过考试(错误)迭代dict,set等等)的函数,其中迭代的稳定性是至关重要的。
dict
set
python collections abstract-class iterator
abstract-class ×1
collections ×1
iterator ×1
python ×1