tubeshowcase●1,194,391 videos♡ My collection 0
← Learn to Code

Learn to Code09:59

The real purpose of Python's match statement, feat. CSTs

mCoding ↗

From the creator

What's the purpose of the match statement in Python? The match statement is commonly mistaken for being Python's way of adding a switch-case statement. NOPE! This is not the intended purpose of the match statement, and it does not have similar performance benefits. Let's see what the match statement is REALLY for by parsing concrete syntax trees (CSTs). ― mCoding with James Murphy (https://mcoding.io) Source code: https://github.com/mCodingLLC/VideosSampleCode libcst: https://libcst.readthedocs.io/en/latest/index.html AST linting vid: https://youtu.be/OjPT15y2EpE Structural pattern matching vid: https://youtu.be/-79HGfWmH_w 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: Jameson, Laura M, Dragos C, Vahnekie, John Martin, Casey G 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 0:20 Switch case? 2:52 ASTs and CSTs 4:14 True, True, True 4:46 Visiting the CST 5:50 Matching the CST 7:50 Addressing complexity

Published 2022-01-30 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code