Code-style for indention of multi-line ‘if’ statement? [duplicate]

Often I work around this problem by calculating the condition in an own statement:

condition = (collResv.repeatability is None or
             collResv.somethingElse)
if condition:
    collResv.rejected = True
    collResv.rejectCompletely()

Though, for a still relatively short condition as in your specific example I’d go for nosklo‘s solution – the extra statement used here is more suited for even longer conditional expressions.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)