Supercharge your code with Python's 'match' statement - Siddharta Govindaraj

Поделиться
HTML-код
  • Опубликовано: 13 сен 2024
  • Supercharge your code with Python's 'match' statement - Siddharta Govindaraj - PyCon Italia 2024
    Elevator Pitch:
    When 'match' statement was added to Python 3.10, I thought it was a confusing feature. But after learning to use it correctly, it became my favourite new feature in Python. In this talk, we will learn how to use match to write much nicer, pythonic code. Then you will also fall in love with match.
    Description:
    When 'match' statement was added to Python 3.10, I thought it was a confusing feature. I thought that it was just a fancy way of doing if/then/else statements. Why do we need a new feature just to make if/then/else a little simpler?
    But I found out that my understanding was wrong. It is not a way to do if/then/else. It is something called structural pattern matching. That was a complicated word for me, but after reading up, the concept is not so difficult. It quickly became my favourite new feature in Python.
    In this talk, we will take a deeper understanding into structural pattern matching and how it is related to match statement. With that understanding, we will learn how to use 'match' effectively. We will also look at some practical day to day situations where 'match' statement makes the python code much cleaner and easy to read.
    By the end, you will understand why this feature was added into Python, how to use it effectively and fall in love with 'match' just like I did.
    Learn more: 2024.pycon.it/...
    #CPython #FunctionalProgramming #CleanCode

Комментарии •