Mention flat indentation 'match: expression'
This commit is contained in:
parent
770d36cc01
commit
fa90054ead
14
pep-0622.rst
14
pep-0622.rst
|
@ -1168,7 +1168,19 @@ In sample programs using `match`, written as part of the development of this
|
|||
PEP, a noticeable improvement in code brevity is observed, more than making up
|
||||
for the additional indentation level.
|
||||
|
||||
TODO: flat indentation with "match: expression" at the top.
|
||||
Another proposal considered was to use flat indentation but put the
|
||||
expression on the line after ``match:``, like this::
|
||||
|
||||
match:
|
||||
expression
|
||||
case pattern_1:
|
||||
...
|
||||
case pattern_2:
|
||||
...
|
||||
|
||||
This was ultimately rejected because the first block would be a
|
||||
novelty in Python's grammar: a block whose only content is a single
|
||||
expression rather than a sequence of statements.
|
||||
|
||||
|
||||
Alternatives for constant value pattern
|
||||
|
|
Loading…
Reference in New Issue