tools & tips
Don't use
os.chdir()
in Django
with uwsgi
! ! !
Counting, without counting, in Python: Brandon Rhodes
# Creates one million integers for i in range(1000000): print # Creates them one at a time for i in xrange(1000000): print
简单的测试 (1 ms = 1000 us = 1000,000 ns) wiki
$ python -m timeit \ > -s 'from itertools import repeat' \ > 'for x in repeat(None, 1000000): pass' 100 loops, best of 3: 16.8 msec per loop