Structural Pattern Matching in Python 3.10

Structural pattern matching resembles the traditional switch statement, but it goes far beyond what the 'simple switch' can do. Some call the `match` statement a domain-specific language to match objects by their structure. `match` statement is a mini-language within Python. Structural pattern matching is clearer to read than long complicated switches or if ...else statements. However, switches and if ...else statements would still be better when there are not too complicated. In a Deep Dive course Part III by Fred Baptiste I learned about structural pattern matching. However, I wanted to get a deeper understanding of the subject. Therefore, I took additional four tutorials on this subject. o The first tutorial “Introduction to Structural Pattern Matching” is at Python Discord. The length of the tutorial is 00:55 total video hours. In this tutorial, I learned: • Matching against the type of the object • Matching against the type of the object and value by using the `guard` statement • Order of the cases matters • Sequence pattern matching using split(), *args keyword and or | • Dictionary pattern matching • Matching custom class instances • Be mindful of bound variables to the previous case You can find this tutorial at https://www.youtube.com/watch?v=n7rNgz4uyZk&ab_channel=PythonDiscord o The second tutorial “Introduction to Structural Pattern Matching” by ArjanCodes where the instructor showed how to use matching to parse arguments and interpret a variety of commands. The length of the tutorial is 00:17 total video hours. In this tutorial, I learned: • How to use a parameter `--force` and *args • Pattern matching on the attribute of the object You can find this tutorial at https://www.youtube.com/watch?v=scNNi4860kk&ab_channel=ArjanCodes o The third tutorial “Python 3.10 Structural Pattern Matching - 3 Examples To Get You Started | Better Data Science” by Better Data Science where I learned pattern matching in the method of a Class. The length of the tutorial is 00:13 total video hours. You can find this tutorial at https://www.youtube.com/watch?v=vAXWX2tCps8&ab_channel=BetterDataScience o The fourth tutorial “Python 3.10 Pattern Matching in Action” by Big Python where I learned how to use matching in JSON API. The length of the tutorial is 00:12 total video hours. You can find this tutorial at https://www.youtube.com/watch?v=SYTVSeTgL3s&ab_channel=BigPython

Our Sidebar

You can put any information here you'd like.

  • Latest Posts
  • Announcements
  • Calendars
  • etc