On 7/11/2020 10:36 AM, Jim J. Jewett wrote:
Glenn Linderman wrote:
On 7/10/2020 3:15 AM, Gustavo Carneiro wrote:
...
Therefore, I posit that the style of try...except indentation only
works where the number of cases is small.
But for the case of pattern matching, I expect the number of cases to
be matched to be a lot higher than exception handling cases.  Having
cases to be matched be indented is, IMHO, a nice visual cue to help
the reader understand where the pattern matching block ends.
Actually, the current  if elseif elseif elseif else, used now because
Python has no switch/match/case, has exactly the same issue as you
describe as a problem with try if there were more cases... and if often
has more cases, just like match will.
True

So your concern seems nebulous. You may have wished for extra
indentation.... but it is simple to get more indentation: use 8 spaces
instead of 4. So if you really wanted it, you could have had it.
Not so true.

It is true, the way I meant it, but not the way you (mis-)interpreted it.

     if a: ...
         elif b: ...
         elif c: ...
     else:

is not valid.  In practice, I interpret wanting to indent at a place that 
doesn't require it as a code smell suggesting I should try to break out a 
helper function, but ... it does happen.

if  a:
        ...
elif b:
        ...
elif c:
        ...
else:
    ...

is perfectly valid.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/IEZ5PTLDDGFTT6763FUH4MNXNXFNWAR2/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to