In [115]: timeit len(list(itertools.repeat(0,10000))) 10000 loops, best of 3: 60.5 µs per loop
In [116]: timeit len([i for i in itertools.repeat(0,10000)]) 1000 loops, best of 3: 290 µs per loop
有人解释说 第二个是生成一个[]然后 append 进去的所以慢, w(゚Д゚)w ,那第一个难道不是?他能知道长度?