Skip to content

Files

Latest commit

 

History

History
26 lines (16 loc) · 630 Bytes

missing-format-attribute.md

File metadata and controls

26 lines (16 loc) · 630 Bytes

Pattern: Missing format attribute

Issue: -

Description

Used when a PEP 3101 format string uses an attribute specifier, but the argument passed for formatting doesn't have that attribute. This message can't be emitted when using Python < 2.7.

Example of incorrect code:

file = open('out.txt', 'w')
"My name is {0.unknown}".format(file) # file type does not have 'unknown'

Examples of correct code:

file = open('out.txt', 'w')
"My name is {0.name}".format(file)

Further Reading