The Python Oracle

Effect of tilde on booleans — why ~True is -2 & ~False is -1 in Python?

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: Hypnotic Puzzle4

--

Chapters
00:00 Question
01:36 Accepted answer (Score 7)
02:23 Thank you

--

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

Question links:
[W3Schools]: https://www.w3schools.com/python/python_...
[This answer]: https://stackoverflow.com/a/34502832/856...
[The PyTables User’s Guide]: https://www.pytables.org/usersguide/data...

--

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

--

Tags
#python #boolean

#avk47