miniblog.
← Back to all posts
Oct 18, 2012 at 15:37
#python `1 in [1,0] == True` => False is a horrible obscure gotcha
https://stackoverflow.com/questions/9284350/why-does-1-in-1-0-true-evaluate-to-false
Wilfred Hughes
Related Posts
Jan 18, 2018 at 00:22
Whilst nil and t are rather strange as booleans, they're wonderfully easy to type. I've finally relented and written a yasnippet for Python because True and False are just too many keystrokes.
Wilfred Hughes
Shared words: python, True, False Score: 43.7
Oct 15, 2013 at 11:40
Yikes. On Python 2 `foo = lambda: 5; print foo > 6, foo() > 6` gives 'True False'. Hides tricky bugs. Another reason to move to Python 3.
Wilfred Hughes
Shared words: python, True, False Score: 43.7
Sep 10, 2013 at 15:49
PEP 285
https://www.python.org/dev/peps/pep-0285/
, which introduced True and False to Python, is worth a read. It's surprising how much controversy it caused.
PEP 285 – Adding a bool type | peps.python.org
This PEP proposes the introduction of a new built-in type, bool, with two constants, False and True. The bool type would be a straightforward subtype (in C) of the int type, and the values False and True would behave like 0 and 1 in most respects (for ...
Wilfred Hughes
Shared words: python, True, False Score: 43.7