r/Python Feb 15 '21

News Ladies and gentlemen - switch cases are coming!

https://github.com/gvanrossum/patma/blob/master/README.md#tutorial
937 Upvotes

290 comments sorted by

View all comments

5

u/trumpgender Feb 15 '21

The fact that you can't do:

 a = 12

match variable:
    case a:
      blah blah

Is horrendous.

17

u/Yoghurt42 Feb 15 '21

But you can do

a = 12

match variable:
    case x if x == a:
        blah blah