osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can global variable be passed into Python function?


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