I recently added this code to a Github project I'm working on:
if not initial_push=='y' and not initial_push=='yes': print('Aborting.') return False Since this is a public repository that I'm hoping people will contribute to, I am considering refactoring that bit as the slightly more readable code:
if initial_push=='y' or initial_push=='yes': pass else: print('Aborting.') return False If my goal is to keep the open-source project accessible to outside contribution then should I use the more readable but clumsy second method? I am actually interested in the answer for the general case, not just this specific example.
Trueinstead of doingpass?if initial_push not in ('y', 'yes'):is more readable than either.