CheyiLin says
14 years ago
5.06ms 與 201us 的效能差距,這真的有改善到 ... GJ !!
Ithinkso says
14 years ago
那就出來講一下怎做的吧 (LOL)
CheyiLin says
14 years ago
Python 撰寫技巧而已啦 ... 有興趣嗎?
khwu.tw says
14 years ago
有!
立即下載
CheyiLin says
14 years ago
簡單說 ... 自行撰寫具備 iteration 能力的物件時,雖然 __getitem__ 也可達到效果,但實作 __iter__ 效能高很多,當你要 iterate 的數量達到 10K 時,就會有我 po 的那種時間差 ...
CheyiLin says
14 years ago
我倒是覺得像 Python 這種喊著「把事情作正確只有一種方法」口號的語言,若被迫使用 __getitem__ 作為 iterate 方法時,應該要 raise exception 警告才是