What is the reason for using a wildcard import?

后端 未结 3 1773
感情败类
感情败类 2020-12-12 07:39

I have just learnt about importing modules, and I am a bit confused about the wildcard import.

from module_name import         


        
3条回答
  •  爱一瞬间的悲伤
    2020-12-12 08:23

    This is used for importing everything from the module. The reason why you are recommended not to use it, is because it can get confusing as to where the function or class you are using came from. Moreover, some things might have the same name in different modules, and importing them like this would overwrite the one previously imported.

提交回复
热议问题