【Regarding Performance of a Python Script....】

Kenzi kenzi.sml at gmail.com
Fri Feb 28 19:24:18 EST 2020


Hello there,

 I have a question regarding a simple code snippet in Python:

from subprocess import check_output
for i in range(1024):
    check_output(['/bin/bash', '-c', 'echo 42'], close_fds=True)

*I wonder why running it in Python 3.7 is much faster than Python 2.7? *
(Python 3.7 is still faster, after I used *xrange * in Python 2.7)

Thanks all!


More information about the Python-list mailing list