作者huggie (huggie)
看板Python
标题[问题] dictionary 的 iterator
时间Wed May 21 14:44:02 2008
请问 iteritems(), iterkeys(), itervalues() 效能会很好吗?
Dictionary 是个 mapping,他是如何支援 iterator?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.129.160.62
1F:→ gasolin:for key, value in dict.items() 05/21 16:30
2F:→ huggie:楼上这种的要做 list 效率应该会更差吧? 05/21 18:03
3F:推 yungyuc:key, value 是个 tuple 05/22 22:06
4F:→ huggie:但他们都放在 list 里面阿 [(),()] 05/23 00:20
5F:推 yungyuc:你没有定义效能;list of tuple 的时间复杂度比较低 05/23 04:41
6F:→ huggie:你的意思是时间复杂度比 iteritems() 低吗? 05/23 15:52