learning-unlimited / ESP-Website

A website to help manage the logistics of large, short-term educational programs
84 stars 57 forks source link

Use Python new-style string formatting #1299

Open jmoldow opened 10 years ago

jmoldow commented 10 years ago

Python 2.6 introduced new-style string formatting, whereby you annotate string templates with {} (instead of %s and variants), and then later call string.format(*args) (instead of using the % (__mod__) operator). See https://docs.python.org/2/library/string.html#string-formatting for more information.

This has been around for a while, but I'd never heard of it until recently, and we don't use it anywhere in our code.

https://docs.python.org/2/library/stdtypes.html#str.format says that This method of string formatting is the new standard in Python 3, and should be preferred to the % formatting. Also, see http://stackoverflow.com/questions/5082452/python-string-formatting-vs-format for some examples of how the new-style formatting is improved from the old-style.

Given that, we might want to consider migrating to new-style formatting at some point, though this is probably low priority.

kkbrum commented 2 months ago

Note that this will be fixed by #3616, I believe.