3 ms·
I'm rather curious about the "non pythonic" part of your comment. The % formatting to me has always felt like a compatibility thing with C and I've always found
by pantsforbirds 4y ago
I'm rather curious about the "non pythonic" part of your comment. The % formatting to me has always felt like a compatibility thing with C and I've always found the {} format style much more pythonic. f strings seem like a logical extension/continuation of that formatting style into something that works really quite well with python in my personal experience.
As an example I think each iteration of formatting is more readable and arguably more pythonic:
log.info("%s is logged into service #%d" % (user_name, service_number))
log.info("{} is logged into service #{}".format(user_name, service_number))
log.info(f"{user_name} is logged into service #{service_number}")
- jl6 4y agoI guess I was thinking about examples like f"{3:0=+5}".