.. _use-implicit-booleaness-not-comparison-to-string: use-implicit-booleaness-not-comparison-to-string / C1804 ======================================================== **Message emitted:** ``"%s" can be simplified to "%s", if it is strictly a string, as an empty string is falsey`` **Description:** *Empty string are considered false in a boolean context. Following this check blindly in weakly typed code base can create hard to debug issues. If the value can be something else that is falsey but not a string (for example ``None``, an empty sequence, or ``0``) the code will not be equivalent.* .. caution:: This message is disabled by default. To enable it, add ``use-implicit-booleaness-not-comparison-to-string`` to the ``enable`` option. **Problematic code:** .. literalinclude:: /data/messages/u/use-implicit-booleaness-not-comparison-to-string/bad.py :language: python **Correct code:** .. literalinclude:: /data/messages/u/use-implicit-booleaness-not-comparison-to-string/good.py :language: python **Configuration file:** .. literalinclude:: /data/messages/u/use-implicit-booleaness-not-comparison-to-string/pylintrc :language: ini Created by the `refactoring `__ checker.