Skip to content

Files

Latest commit

 

History

History
33 lines (20 loc) · 729 Bytes

redefined-builtin.md

File metadata and controls

33 lines (20 loc) · 729 Bytes

Pattern: Redefining built-in

Issue: -

Description

Used when a variable or function overrides a built-in. Overloading function names can make code hard to maintain and hard to read, and can cause subtle bugs when the wrong function is called.

Try to rename user-defined function to a name that is not a built-in function.

Example of incorrect code:

def function():
    type = 1
    print(type)

Example of correct code:

def function():
    x = 1
    print(x)

Further Reading