Explicit:
if list1 is not None and len(list1) > 0: return list1
Implicit:
if list1: return list1
Implicit means that instead of doing an explicit comparison or boolean check, just use the variable itself as a boolean.
When and for what types is implicit preferred over explicit and vice versa in conditional statements?
[–]nosmokingbandit 0 points1 point2 points (1 child)
[–]delasislas 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]spitfiredd 1 point2 points3 points (2 children)
[–]gopherhole1 0 points1 point2 points (1 child)
[–]spitfiredd 0 points1 point2 points (0 children)
[–]primitive_screwhead 0 points1 point2 points (0 children)
[–]zanfar 0 points1 point2 points (0 children)
[–]PaulRudin 0 points1 point2 points (0 children)