2 ms·
It amazes me how so many times this python feature gets overlooked: >>> x=5 >>> 1<x<10 True >>> 1<x<3 False EDIT: fixed spaces, thanks epo
by samratjp 16y ago
It amazes me how so many times this python feature gets overlooked:
>>> x=5
>>> 1<x<10
True
>>> 1<x<3
False
EDIT: fixed spaces, thanks epochwolf for the indent tip.
- epochwolf 16y ago>>> x=5 >>> 1<x<10 True >>> 1<x<3 False (Indent 4 spaces to show code)
- judofyr 16y agoIf anyone is interested, here's how you could implement it in Ruby: http://judofyr.net/posts/chained-comparisons.html http://judofyr.net/posts/chained-comparisons.html
- mkramlich 16y agothat's good-strange, though, not bad-strange. i think in the OA they were mostly talking about bad-strange.