The Hottest New Feature Coming In Python 3.10 - Structural Pattern Matching / Match Statement

preview_player
Показать описание
My take on the most important new feature in Python 3.10.

It's the match statement and structural pattern matching.

SUPPORT ME ⭐
---------------------------------------------------

BE ACTIVE IN MY COMMUNITY 😄
---------------------------------------------------
Рекомендации по теме
Комментарии
Автор

SWITCH STATEMENTS IN PYTHON
FINALLY
HOLY SHIT
AND ITS ACTUALLY REALLY WELL DONE AND HAS SO MANY FEATURES YES YES YES

Ganerrr
Автор

Python finally has something close to a switch statement, “on steroids” indeed

karimsabbagh
Автор

I read the PEP a while ago. This is an excellent feature. I have a whole load of matching and filtering code for processing silicon data. I can greatly simplify it with this.

davidjohnston
Автор

I'm getting crazy Haskell vibes. This feature will completely transform the language. What a time to be alive!

Soul-Burn
Автор

I first saw this ability in scala and immediately prayed for this to be implemented in python

nirmalpatel
Автор

honestly underrated channel.

I dont know why but im very excited for this

Omikronik
Автор

Oh. My. God.
It even works with classes, nested stuff, wildcards, the | thing, it's so cool
It's just like haskell or scala or something

barmetler
Автор

This is going to be really interesting. I loved the walrus operator, and I know it was a really controversial one, but it is very useful for me. I don't always use it, only when it seems the best tool to use, so all of the comments saying the code is going to be really hard to understand didn't make sense at least on my workflow. Everything continues to look like what it was, except there are some walrus in some if( x := re.match(s)) commands sprinkled here and there. My code is not pythonic, but that is just because I am not a good programmer, not because of the updates lol

I hope the community doesn't bash on this too, after all it does seem very practical and powerful

astropgn
Автор

The greatest thing about this is no Fall through. Otherwise breaking in every Case like C/C++ would kill the vibe

hardikksharmaaa
Автор

Seems very similar to rust's `match` statement, always liked that and looking forward to using it in python

KingJellyfishII
Автор

The main feature from Elixir I really liked. Not as clean as in Elixir, but looks more flexible and you get all that Python goodness, too.

erbernaljr
Автор

Fantastic explanation of the new feature

Banflax
Автор

Dude im in love with both your voice and content. You sound like the context free channel and I love every video of yours. Keep it up!

Tal__Shachar
Автор

This reminds me a lot of the match statement in functional programming languages (I saw it in OCaml). Insanely powerful tool, so excited!

qwertycomp
Автор

Just reading through the implemented PEPs, I found this one to be especially interesting too, in terms of pushing readability:
"PEP 604 – Allow writing union types as X | Y"
This is MAJOR.
I really really like type hinting, but it messed up function signatures more often than not.
Python functions often tend to be very flexible and therefore need typing strings like this: Union[Dict[str, Union[int, float]], Tuple[str, Union[int, float]]]
That's unreadable.

New way: Dict[str, int|float] | Tuple[str, int|float]
Clear and to the point. Even better would be short-hand syntax for list, dict, set and tuple, by doing something like this:
{str, int|float} | (str, int|float)
This saves quite some characters and removes phrases like "Dict", "List", etc. from the type definition, as they are already defined by their respective enclosing characters.

spacebibba
Автор

Nice!
I have had a few times, where I really wanted this feature in Python.

jonilarsen-haikarainen
Автор

Just discovered your channel and I've already learned so much. Keep making such videos

shreydixit
Автор

I stumbled upon your channel a few days ago and I have to say, everything you do is great! Keep it up.

AntonioZL
Автор

I never thought I'd get this excited for a feature in a language

sbk
Автор

I started learning Python pretty recently in order to complete a project, learning what I need to know to solve the problems as and when I come across them. I just happened to be at a stage where I needed exactly this feature and it's just been released, awesome. Thanks for the video!

SamCropper