Skip to content

Files

Latest commit

 

History

History
25 lines (15 loc) · 570 Bytes

not-callable.md

File metadata and controls

25 lines (15 loc) · 570 Bytes

Pattern: Calling uncallable object

Issue: -

Description

This issue is usually a result of name collision between class/method or module/function. Because of this a TypeError is raised at runtime. Fully qualify the called function or use more specific import statements to resolve this issue.

Example of incorrect code:

import random

print(random()) # [not-callable]

Examples of correct code:

from random import random # more specific import statement

print(random())
print(random.random()) # fully qualified function