Recently, I encountered a problem when writing a python application: When a module is introduced, a custom int is automatically introduced to the namespace of python, which overwrites the intfunction that comes with python. because we need to use the python int, we have to find the method to re-introduce this int. fortunately, this problem is easy to solve. we only need to use _ builtins __:
From _ builtins _ import int as py_int
In this way, we can re-use the python int, but in this case it is called py_int.
The most common reason for overwriting a function or variable is that "*" is used for reference "*":
From something import *
When using import in this way, we cannot provide clear guidance on which variables or functions are introduced, or whether these variables or functions will overwrite the original variables or functions. therefore, this is one of the main reasons why "*" is not recommended during import.
In python 3, you can use builtins instead of _ builtins __.