News for hackers. Stuff that matters.
Re:Flake8-Logging by mikepurvis on Monday September 11, 2023 @03:03PM (#37472096)
Surely string interpolation is cheap, especially given that we're talking about Python here?

I'd be more worried about cases where you're calling some function to produce a novel value that will then be included in the log string— and Python doesn't have lazy argument evaluation so you'll pay the cost of that function call regardless.

Re:Flake8-Logging by RandomBK on Monday September 11, 2023 @03:14PM (#37472268)
If it's CPython we're talking about, a function call can cause non-negligence performance impact in a hot loop. I wouldn't assume anything in Python is 'cheap'
Re:Flake8-Logging by squeaky-clean on Monday September 11, 2023 @06:59PM (#37474841)
Relative to python it's cheap. A set of Ferrari tires for $1000 is simultaneously expensive but also very cheap compared to the normal cost.

Basically, if you're worried about string formatting overhead, it's probably time to ditch Python.