why one line "for" expression is faster in Python? -
this question has answer here:
i have tested 4 situations.
1.
testlist = list() in range(1000000): testlist.append(i)
2.
testlist = list() in range(1000000): testlist.append(i)
3.
testlist = list() newappend = testlist.append in range(1000000): newappend(i)
4.
[i in range(1000000)]
each time was
1 : 0.09166
2 : 0.08299
3 : 0.05003
4 : 0.04594
why others faster 1?
can find related keywords?
Comments
Post a Comment