Python all([6,7,8,9]) = True. But 6 = False
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Lost Jungle Looping
--
Chapters
00:00 Python All([6,7,8,9]) = True. But 6 = False
00:52 Accepted Answer Score 2
01:23 Thank you
--
Full question
https://stackoverflow.com/questions/4166...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #python3x #boolean #shortcircuiting
#avk47
    Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Lost Jungle Looping
--
Chapters
00:00 Python All([6,7,8,9]) = True. But 6 = False
00:52 Accepted Answer Score 2
01:23 Thank you
--
Full question
https://stackoverflow.com/questions/4166...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #python3x #boolean #shortcircuiting
#avk47
ACCEPTED ANSWER
Score 2
Check me: what you’re really asking is, 6 and 7 appear to be False, so why is the second expression True. If so, the answer is that nonzero integers evaluate to True in a boolean context; but when you test 6 == True, the integer is not being coerced into a boolean type, so effectively you’re testing 6 == 1, which is False.
Edit: The correct way to test if something is True in a boolean context is, for example:
bool(6)