#Python 🐍 3.10: has a "Switch" like statement.

But it's not a switch, it's called "Pattern Matching."

Pattern matching is way beyond the "Switch Statement"
πŸ‘‡ python Pattern matching is like Switch Statement
The pattern matching takes a value following match and allows us to write out several potential cases, each defined by case. Where we find a match between the match-case we will execute the respective code. #programming πŸ‘‡
Even though it is not a "switch", it can be used as.πŸ‘‡
You can use patterns to match even more complex structures, like tuples, lists etc. You can nest them. You can have redundancy checking. #coding You can use patterns to match even more complex structures.

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Akshay πŸ‘¨β€πŸ’» Kaushik 🐍

Akshay πŸ‘¨β€πŸ’» Kaushik 🐍 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @AkshaykKaushik

Feb 5
Do you know #Python "Data Classes"

They are a great Python feature that can help you write less code

🧡Let's find out moreπŸ‘‡
1️⃣ dataclass decorator adds generated methods
- __init__
- __repr__
- __eq__

to the class and returns the same class it was given. This module provides a deco...
2️⃣ Generated __init__ method takes all fields as function parameters. Their values are set to instance attributes with the same names.

Fields are defined as type annotated class attributes.

For example, you can define User with fields id and name.πŸ‘‡ A dataclass is a Python mod...
Read 9 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

:(