Python logoPython/
PYL-W1303

Missing format argument keyPYL-W1303

Major severityMajor
Bug Risk categoryBug Risk

The format string has one or more named fields which are not provided by the keyword arguments. This will raise a KeyError.

It is recommended to remove the unused field or provide an argument for it.

Bad practice

format_string = "The coordinates are ({x}, {y}, {z})".format(x=1, y=2)
print(format_string)
format_string = "The coordinates are ({x}, {y}, {z})".format(x=1, y=2, z=-4)
print(format_string)