A Closer Look At Structural Pattern Matching // New In Python 3.10!

preview_player
Показать описание
In this video, I show an example of structural pattern matching, a pretty powerful feature that's part of Python 3.10. There are a couple of really nice things you can do with this, and although it resembles the traditional switch statement, it goes far beyond what the 'wicked switch' can do.

🎓 Courses:

👀 Channel code reviewer board:
- Ryan Laursen
- Sybren A. Stüvel

🔖 Chapters:
0:00 Intro
1:02 Explaining the example
1:35 Simple pattern match example
3:37 A more elaborate match example
7:49 Match with conditions
9:30 Match with objects
14:42 Caveats of using structural pattern matching
16:11 Other Python 3.10 features & final thoughts

#arjancodes #softwaredesign #python

DISCLAIMER - The links in this description might be affiliate links. If you purchase a product or service through one of those links, I may receive a small commission. There is no additional charge to you. Thanks for supporting my channel so I can continue to provide you with free content each week!
Рекомендации по теме
Комментарии
Автор

Too bad my camera decided to switch off near the end. It probably couldn't handle the awesomeness of structural pattern matching 😎.

ArjanCodes
Автор

Idea for a future series:
Go through a module, for example pathlib, and breakdown the inner workings. There is so much to learn from the professionals who write production grade code.

dovids.greenberger
Автор

10:35 since you're explicitly working with Pyton 3.10, you can just use list[str] instead of the typing import. Same with dict, tuple, set etc.

randolphbusch
Автор

typing.List[T] => list[T] since python 3.9

petoknm
Автор

Honestly, love this addition to the language. Originating from C and being a procedural programming junkie myself, I missed the equivalent of a switch statement in Python and dreaded writing long-winded if-elif-else statements, so I'll def be using match a lot

TheJobCompany
Автор

Another great video. Thank you for so many examples in a series to show the features and always appreciate the high audio/video production quality of your videos and I love your choice of background and lights.

iChrisBirch
Автор

Thank you so much for the explanation! Structural Pattern Matching is more powerful than I imagined and I can't wait to try it out!

hicoop
Автор

The amount of work goint into these videos is astounding. I am so happy that I have found your channel, there are so many ways one can write cleaner code but it's always explained a not easy to understand way, unlike here. Thank you for your awesome videos!

CaptainCsaba
Автор

Rust programmer: welcome to the club! This is an amazing language feature.

AnAmiC
Автор

Switch case in python is something that I've been waiting for so long. Your tutorials are amazing by the way.

luismiguel
Автор

Arjan I recently discovered your channel and honestly your way of expressing whatever the idea on your mind is very precise and neat. Me and my friends also have a channel for educational content mostly on software and your channel really re-inspired me. I have spent lots and lots of hours on YouTube trying to find good quality and fun content on topics like these and you are golden. Thank you. Can't wait to see more of your content!

goktugbasaran
Автор

This new version is looking promising! I've been waiting for this feature for so long. 😂
I appreciate your content, man. Keep up the good work!

douglasfrb
Автор

your videos are always very interesting. thank you !

patricktarnaud
Автор

Your content is great, keep up the good work!
I just love to watch your videos when eating breakfast or just chilling after a hectic workday.

AndreasFalk
Автор

Just starting to master structural pattern-matching in Scala and it's good to see it coming to Python 3. Loving your videos.

mrc
Автор

Thank you!! Beautifully explained. You are a gifted teacher. I previously watched another video on this topic and was baffled. After your video I feel primed for the 3.10 release.

dovids.greenberger
Автор

I skipped this video when it came out, because I wanted to watch it when I start using Python 3.10. But somehow Youtube stopped recommending me your videos (have been watching one every day for the last weeks) - so I decided to go to your channel and browse the videos by myself. Turns out: this is the only one I haven't watched yet. Great job!

samuel.stelzer
Автор

This looks amazing for beginners that want to be able to easily parse input, or perhaps even files (by looping over lines).

NostraDavid
Автор

I've been enjoying your library of videos! Keep it up

thefrator
Автор

Best tutorials on Structural pattern matching....
Thanks 🙏🙏🙏
After this tut, dev will use it for complex it-else,
Waiting for V2 of it, with regex & using async task group on functions part of each case

SP-dbsh