>> be expanded to >>>> _temp = expr >> if _temp: return _temp >> This could be simplified to just: >> return expr or None > """ No, it can't be simplified in this way. If there is code after that snippet, then it will get executed in the original version if _temp is false, but won't get executed in your simplification. Regards, Martin