Hacker News new | past | comments | ask | show | jobs | submit login

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.



If anyone is interested, here's how you could implement it in Ruby: http://judofyr.net/posts/chained-comparisons.html


    >>> x=5 
    >>> 1<x<10 
    True 
    >>> 1<x<3 
    False
(Indent 4 spaces to show code)


that's good-strange, though, not bad-strange.

i think in the OA they were mostly talking about bad-strange.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: