0

Importing modules in python

If i can import module using this method: from module import * Can you tell me a situation where it is more advantageous to use the method below: import module Because, as of now, i could only think of one advantage but i'm not so sure if it really is.

5th Sep 2019, 10:05 AM
Rex Fajardo
Rex Fajardo - avatar
3 ответов
+ 2
When you use the first method, all names in module_name are placed inside the current modules namespace, this can lead to naming conflicts if there are similar names in both modules. Plus it takes more time to load all names if u use the first method. You should do it for relatively small modules
5th Sep 2019, 10:22 AM
Mensch
Mensch - avatar
0
Thank you for both of answer, yeah name clashing was the one i was thinking of.
5th Sep 2019, 10:33 AM
Rex Fajardo
Rex Fajardo - avatar