作者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