On Tue, 21 Feb 2023 at 11:29, Steven D'Aprano <st...@pearwood.info> wrote: > Trying to squeeze many lines of code into one line is a bad idea.
Agreed, in most cases - but there can be (no pun intended.. probably) exceptions to that. if cloudy or raining: print("Bring an umbrella") else: print("Looks fair out") In rare cases, vertical screen space -- and/or even file read and program performance -- can be affected by the number of lines required to represent a module. On Mon, 20 Feb 2023 at 15:03, Otomatyk dupont <otoma...@gmail.com> wrote: >> #import A_WINDOW_MODULE and import A_UNIX_MODULE if except Here's an attempt to rephrase this slightly, with the following ideas in mind: * Reduce parser ambiguity * Support filtering based on specific exception classes * Rephrase the code to read more closely like natural language >>> try import A_WINDOW_MODULE but import A_UNIX_MODULE on ImportError >>> try value = int(x[2]) but value = 0 on IndexError, ValueError _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/UKAP4NDEWRKI2KC6XBQJOUWQC6CIIQQY/ Code of Conduct: http://python.org/psf/codeofconduct/