On 7/11/2020 7:54 PM, Greg Ewing wrote:
I can see that being a reasonable choice if you're using 8-space
indents, but I don't see that done much in Python.
Also, directly translating this into Python leads to something that
looks like a mistake:
match x:
case 1:
...
case 2:
...
and as has been pointed out, the alternative of putting x on the
next line is unprecedented in Python.
If the 2 levels of indenting are really offensive, surely we could teach
editors, black, ourselves, etc. to indent the match statement as:
match pt:
case (x, y): # <-- indent by two spaces
return Point3d(x, y, 0) # <-- indent by 2 more spaces, for a
total of 4
if x:
return x # <-- normally indent by 4 spaces
I used to do something similar with C switch statements.
I guess you couldn't use this trick if you were using tabs. Another
reason to not use them!
Eric
_______________________________________________
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/MZWH24XT5PDP3THWC6LL6Q4ITAASAKON/
Code of Conduct: http://python.org/psf/codeofconduct/