In writing some XML parsing code, I received the warning:
FutureWarning: The behavior of this method will change in future versions. Use specific \'len(elem
if obj is not None test whether the object is not None. if obj tests whether bool(obj) is True.
There are many objects which are not None but for which bool(obj) is False: for instance, an empty list, an empty dict, an empty set, an empty string. . .
Use if obj is not None when you want to test if an object is not None. Use if obj only if you want to test for general "falseness" -- whose definition is object-dependent.