why one line "for" expression is faster in Python? -


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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -