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.
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.
-jJ
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/RVMN33GUGKUUFCEEHYCNJPT7MQ7AI5IW/
Code of Conduct: http://python.org/psf/codeofconduct/