Skip to main content


Found something interesting out the hard way. #Python
from string import Formatter

a = 0
b = 1

print(f"{a or b}")  # Works
print("{a or b}".format(a=0, b=1))  # Does not work
print(Formatter().format("{a or b}", a=0, b=1))  # Does not work
in reply to Neil E. Hodges

Makes sense, but I definitely see the potential for confusion there!