Skip to content

Files

Latest commit

 

History

History
28 lines (17 loc) · 609 Bytes

undefined-all-variable.md

File metadata and controls

28 lines (17 loc) · 609 Bytes

Pattern: Undefined name in __all__

Issue: -

Description

Used when an undefined variable name is referenced in __all__. Python raises a ImportError whenever another module attempts to use this undefined object.

Example of incorrect code:

# NonExistant is listed in __all__ but is not defined in this module. An error is expected.
from os import path
from collections import deque

__all__ = ['deque', 'NonExistant', 'path']  # [undefined-all-variable]

Example of correct code:

from os import path
from collections import deque

__all__ = ['deque', 'path']