I have a script that relies on argparse. The mainbody of the script has if statements like this:
if results.short == True and results.verbose == False and results.verbose2 == False and results.list == False and results.true == False:
Isn’t there any shorter way to do that? Say I have more than those 5 arguments, typing each of them in every statement seems like repetitive work.
Can’t if do something like:
if results.short == True and "results.%s"== False % (everyotherresults.something):
I’m writing for Python 2.7
you shouldn’t compare to
boolin boolean expressions, eg: