AFAIK pylint's logging-format-interpolation tries to nudge me to use "%"-interpolation so it can delay execution to cases where it is strictly necessary, as e.g. described here.
However, I am not able to produce an example where this delay actually happens:
import logging
logging.basicConfig(level=logging.INFO)
def log_identity(s: str) -> str:
logging.warning('warning %s', s)
return s
logging.debug('%s', log_identity('c')) # Expect delay, i.e. no warning c
logging.debug(f"{log_identity('d')}") # Expect no delay, i.e. warning d
However, while the actual debug part never emits a message (as per expectations), the strings get interpolated both times:
WARNING:root:warning c
WARNING:root:warning d
Short of explicitly using .isEnabledFor
(cf. here), is there a way of preventing evaluation of log messages using "%"-interpolation? If so, how does it look?