Can global variable be passed into Python function?

wxjmfauth at gmail.com wxjmfauth at gmail.com
Mon Feb 24 10:35:40 CET 2014


Le lundi 24 février 2014 01:37:42 UTC+1, Steven D'Aprano a écrit :
> 
> 
> 
> Performance can matter :-)
> 
> 
> 


>>> timeit.timeit("'abc' * 1000 + 'z'")
0.991999136702321
>>> timeit.timeit("'abc' * 1000 + '\N{EURO SIGN}'")
2.5462559386176444
>>> 

Two points to notice

- Even with utf-8, the worse performance case, such
a difference reaches [0.x - a few] percent.

- Indexing? Very well preserved for the "abc part"

jmf



More information about the Python-list mailing list