Returning the likelihood of a variable rather than its value?
Consider this code:
test_string = 'not empty'
if test_string:
return True
else:
return False
I know I can build a conditional for this:
return True if test_string else False
However, I don't like testing whether a boolean is true or false, when I would rather return a boolean. How can I just get my truth back?
+3
source to share