The 1 line version is more efficient in LOC, if not real performance. But woe unto the lead dev who now has to spend a 1/2 hour explaining it to a junior dev who doesn't get it. The multi-line version is at least explicit about what it's doing.
Anonymous:
brillant! but just to be extra supa dupa clear, you should write it instead as follows:
if expression==True: x = True
if expression==False: x = False
Comments