
On Tue, 21 Feb 2023 at 11:29, Steven D'Aprano <steve@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 <otomatyk@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