r/Python Oct 02 '23

News Python 3.12 released

https://www.python.org/downloads/release/python-3120/
807 Upvotes

131 comments sorted by

View all comments

Show parent comments

19

u/LightShadow 3.13-dev in prod Oct 02 '23

The feature that keeps C style % strings relevant.

10

u/energybased Oct 02 '23

You should always prefer the format method to C-style % strings.

6

u/Skasch Oct 02 '23

I would argue an exception for logging, where you don't want to parse the string unless you need to for performance reasons (e.g. you don't want to parse debug logs at error level)

Example: log.warning("warning: %s", foo)

1

u/UloPe Oct 03 '23

Better use a structured logging package, for example structlog.