shadowing

Using a name that already means something, such as list or str, for your own variable, which hides the original in that part of the program.

Hiding a built-in or a module causes confusing errors far from the line that caused them.

In more detail

It is legal but unwise: after list = [1, 2], calling list("abc") fails because list now means your list. The same happens to a module when you name your own file random.py or math.py. Choose another name, such as items.

Related terms

Taught in

References

Certification courses