On 11/07/20 11:20 pm, Paul Sokolovsky wrote:
On 2020年7月11日 22:49:09 +1200 Greg Ewing <[email protected]> wrote:or like this: switch (x) { case 1: ... case 2: ... default: ... }Oh really, you never saw that? Well, they say that any programmer should eyeball the source code of the most popular open-source OS at least once: https://elixir.bootlin.com/linux/latest/source/kernel/sys.c#L2144
I stand corrected -- it seems I haven't looked at other people's switch statements all that much. 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. -- Greg _______________________________________________ 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/QWSYAU3WIXHG2TYKMGJTARDJ2Z7A7YN4/ Code of Conduct: http://python.org/psf/codeofconduct/