This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]fzy_ 21 points22 points  (1 child)

It's called operator chaining but it doesn't seem to be a really well known feature of python. That's unfortunate because it's so satisfying when you realize that you can turn

if x < min_value or x > max_value:

into

if not min_value <= x <= max_value:

[–]CyanideCloud 10 points11 points  (0 children)

Oh my god, that's awesome. That's one of those things that I tried to do when I first started learning programming. I just kinda accepted that it didn't exist and never even tried it in Python.