4 ms·
Not sure what you mean, but the accepted PEP does appear to be a statement. What was the alternative?
by nneonneo 6y ago
Not sure what you mean, but the accepted PEP does appear to be a statement. What was the alternative?
- the_duke 6y agoIn many languages match is an expression, so you can do things like `x = match y { ... }`, which is a very common use case. I don't write much Python these days, but it being a statement rather than an expression is disappointing It forces you to use a separate "output" variable or `return`.
- klyrs 6y agoI presume that the alternative to a statement is an expression. For example, the ternary operator x = (a if c else b) is an expression, where the conditional equivalent if c: x = a else: x = b is a statement.