Skip to content

Files

Latest commit

 

History

History
24 lines (14 loc) · 603 Bytes

too-few-format-args.md

File metadata and controls

24 lines (14 loc) · 603 Bytes

Pattern: Too few format arguments

Issue: -

Description

Calls to format() that do not match formats against args may lead to confusion as code will not work as expected. Extra arguments will not be shown and missing arguments will raise IndexError. Update code so that formats and args are in sync.

Example of incorrect code:

"{0} {1} {2}".format(1, 2) # [too-few-format-args]

Example of correct code:

"{0} {1} {2}".format(1, 2, 3)

Further Reading