Doing "if cls:" will return False in the case in
which the class has no attributes. The class implements
the method len() which returns the number of class
attributes and which is also used to test the truth value
of "if cls:". In the case in which the class has only
methods, the truth value will be False even if the object exists.
It is better to compare the reference of cls with None.
Doing "if cls:" will return False in the case in which the class has no attributes. The class implements the method len() which returns the number of class attributes and which is also used to test the truth value of "if cls:". In the case in which the class has only methods, the truth value will be False even if the object exists.
It is better to compare the reference of cls with None.