Current situation:
def isTooLarge(intValue):
if intValue > 100: print "too large"; return True
return False
if isTooLarge(101): break
Now I like to make the function more "library-friendly" by returning the errormessagetext instead of printing it:
def isTooLarge(intValue):
if intValue > 100: return True, "too large"
return False
bln,str = isTooLarge(101)
if bln: specialprint(str); break
Any idea how I can evaluate it as an one-liner again? (something like "if ,str isTooLarge(101): specialprint(str); break" or what is the Python way here?
No problem to put the errormessage into a global variable like "lasterrormessage" and keep the rest as is.