Comparison operators in #Python can be chained together, but using them that way could be controversial. I wrote this this other day:
=> More informations about this toot | More toots from nedbat@hachyderm.io
@nedbat I'm a big fan of parentheses for clarity, even when they're technically not needed.
=> More informations about this toot | More toots from ehmatthes@fosstodon.org
@ehmatthes But parentheses would break the comparison here.
=> More informations about this toot | More toots from nedbat@hachyderm.io
@nedbat 🤦♂️
=> More informations about this toot | More toots from ehmatthes@fosstodon.org
@nedbat I like how ...
is actually a usable value in Python, so the code as you wrote it is literally runnable as well.
=> More informations about this toot | More toots from sybren@mastodon.art
@sybren @nedbat ... or ...
? If it's the first one, can you develop more ?
=> More informations about this toot | More toots from OSchell@mastodon.social
@OSchell @sybren The Unicode ellipsis is not a valid identifier :(
… = 1
File "", line 1
… = 1
^
SyntaxError: invalid character '…' (U+2026)
=> More informations about this toot | More toots from nedbat@hachyderm.io
@nedbat @OSchell that's a shame. Well, at least we do have the ASCII ellipsis.
=> More informations about this toot | More toots from sybren@mastodon.art
@nedbat a little too clever for my tastes
=> More informations about this toot | More toots from tintvrtkovic@mastodon.social
@tintvrtkovic @nedbat the counter argument would be that the chaining of these operators is precisely the same as chaining inequalities in my sixth grader's math homework. I think they are unintuitive only when one still has a "thinking in C" sort of mindset, where this would be impossible.
=> More informations about this toot | More toots from tartley@mastodon.social
@tartley @nedbat No, I get it. But it also looks like
text/gemini
This content has been proxied by September (ba2dc).