if
statement can be simplified PYL-R170312
13def _is_url(text):
14 parsed = urlparse(text)
15 if (parsed.scheme) and (parsed.netloc):16 return True
17 else:
18 return False
The highlighted if
block can be refactored into a simplified statement, increasing its readability.
def simplifiable_if(arg, arg2):
if arg and not arg2:
var = True
else:
var = False
return var
def simplifiable_if(arg, arg2):
var = bool(arg and not arg2)
return var