bpo-32262: Fix codestyle; use f-strings formatting where necessary. by 1st1 · Pull Request #4775 · python/cpython (original) (raw)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's logging :(

logger.debug('Get address info %s', msg) -- means that msg will be interpolated only if the logging is ON and the logging level is DEBUG. Otherwise, msg.__str__() won't be called. This is a performance thing, as __repr__() and __str__() can be expensive for some objects.

logger.debug(f'Get address info {msg}') would mean that msg.__str__() is always called, even when logging is disabled.