4 ms·
I disagree. In logging for example, ‘%s’ with the value as an argument to the logger is preferred because the formatting can be ignored if the log level is not
by cochne 7y ago
I disagree. In logging for example, ‘%s’ with the value as an argument to the logger is preferred because the formatting can be ignored if the log level is not sufficient to print.
- orf 7y agoLog formatting is a different problem than string formatting. With log formatting you pass the formatting arguments as function parameters, which is completely different from any other way you format strings.
- AlexandrB 7y agoI think you're getting downvoted because logging is basically doing: def log(fmt, *args): print(fmt % args) Hardly a huge change.
- heavenlyblue 7y agoExcept log formatting isn’t the same as actually executing the expression passed to the logging function.