最佳答案
我希望 Python 的 key 方法返回一个集合而不是一个列表。因为它非常类似于散列表的键所提供的那种保证。具体来说,它们是唯一的,不像集合那样排序。但是,此方法返回一个列表:
>>> d = {}
>>> d.keys().__class__
<type 'list'>
这仅仅是 Python API 中的一个错误,还是我遗漏了其他原因?