The Python Oracle

Why is if True slower than if 1?

This video explains
Why is if True slower than if 1?

--

Become part of the top 3% of the developers by applying to Toptal
https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Romantic Lands Beckon

--

Chapters
00:00 Question
01:51 Accepted answer (Score 43)
02:25 Answer 2 (Score 21)
03:47 Thank you

--

Full question
https://stackoverflow.com/questions/1812...

Question links:
[this question]: https://stackoverflow.com/questions/1007...

Accepted answer links:
[Python 2]: http://docs.python.org/2/reference/lexic...
[Python 3]: http://docs.python.org/3/reference/lexic...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #performance #ifstatement #boolean #timeit

#avk47