3 ms·
What does the feature discussed in TFA (chained comparisons) have to do with Python 2 vs Python now. As another commenter pointed out [0] this feature existed
by throwaway313373 2y ago
What does the feature discussed in TFA (chained comparisons) have to do with Python 2 vs Python now.
As another commenter pointed out [0] this feature existed since 1.4 [1].
Also, I don't understand why so many people seem to be so confused/surprised by it. I can't be 100% sure because it was a long time ago, but I think that a lot of tutorials/introductory articles mention it. Like, "Hey, did you know that Python has this cool syntaxic sugar for this thing? Fascinating!". I think that I learned about chained comparisons long before I wrote my first line of Python.
[0] https://news.ycombinator.com/item?id=42038451 https://news.ycombinator.com/item?id=42038451
[1] https://docs.python.org/release/1.4/tut/node40.html#SECTION00660000000000000000 https://docs.python.org/release/1.4/tut/node40.html#SECTION0...
- carlmr 2y agoI wrote Python for years before seeing it somewhere, going huh, and then I thought it's quite neat. I still don't think it's that confusing. It does what you think it should if you're reading pseudocode, which is after all kind of Python's MO.