Why use generic import?


I have a question. You can use generic imports to import an entire module, but then you would have to write module_name. in front of every function.
If you don't wish to do that, you can instead choose to use universal import. But why would you then use the generic import?



generic import prevents name conflicts. give you modulename.functionname, there is a very unlikely that it will conflict with another library.

while if you use the universal import on multiply library's, you might have the same function name twice (if you have many library's, and maybe some of your own) this can become a serious problem


Thank you for the quick answer.

This makes sense to me, and it is what i would expect. But it leads me to another question.
When would you then use universal import?


well, if you have just 1 or 2 library's it is very unlikely there are conflicting functions. And then the name is shorter to write.

Also, you could consider just important the function you need, if you just need very little functions from a library:

from x import w,y,z


I see. Thank you for your time and help.