tubeshowcase●1,143,283 videos♡ My collection 0
← Learn to Code

Learn to Code11:27

Why I don't like Python's chained comparisons

mCoding ↗

From the creator

Are multiple comparisons unintuitive or am I out of touch? Python allows multiple comparisons chained together in the same expression. They have their uses, but the chaining can become confusing when operators of different types are mixed. Why is it that less than and greater than are allowed to be chained together? I think this is confusing and should potentially even be removed from Python. ― mCoding with James Murphy (https://mcoding.io) Source code: https://github.com/mCodingLLC/VideosSampleCode Chained comparison docs: https://docs.python.org/3/reference/expressions.html PEP to expand chained comparison: https://www.python.org/dev/peps/pep-0535/ SUPPORT ME ⭐ --------------------------------------------------- Patreon: https://patreon.com/mCoding Paypal: https://www.paypal.com/donate/?hosted_button_id=VJY5SLZ8BJHEE Other donations: https://mcoding.io/donate Top patrons and donors: Laura M, Jameson, John Martin, Vahnekie, Pieter G, Sigmanificient BE ACTIVE IN MY COMMUNITY 😄 --------------------------------------------------- Discord: https://discord.gg/Ye9yJtZQuN Github: https://github.com/mCodingLLC/ Reddit: https://www.reddit.com/r/mCoding/ Facebook: https://www.facebook.com/james.mcoding CHAPTERS --------------------------------------------------- 0:00 Intro to chained comparisons 4:25 Good use cases 5:40 Questionable use cases 7:36 Bad use cases 10:42 Numpy use case

Published 2021-09-04 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code