+ 5

Why is repr faster than str? 🐍

With timeit.timeit I've found out that using str constructor can even be twice slower than using the builtin function repr. Even though they often do the same task? Why? https://code.sololearn.com/cAVqZr1qXy9M/?ref=app

27th Jun 2019, 1:53 AM
Seb TheS
Seb TheS - avatar
4 Antworten
+ 3
I dont know
27th Jun 2019, 1:48 PM
Artur King
Artur King - avatar
27th Jun 2019, 5:16 AM
Maninder $ingh
Maninder $ingh - avatar
+ 3
Artur King perfect answer.
27th Jun 2019, 2:15 PM
Seb TheS
Seb TheS - avatar
+ 3
Artur king you are officially right
28th Jun 2019, 10:45 AM
Juri M