Anonymous Confessions from Programmers.
if expression: x=True else x=False:
( 33 )
( 391 )
That is the true sign of a weak programmer.
It gets better.
x = expression :) :)
x = (bool) expression;
The guy I replaced did this everywhere...
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.
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
Maybe "True" and "False" are objects.