CBSE Class 12 Computer Science Question 45 of 62

Using Python Libraries — Question 13

Back to all questions
13
Question

Question 13

Why should the from <module> import <object> statement be avoided to import objects ?

Answer

The from <module> import <object> statement should be avoided to import objects because it imports objects directly into the current namespace. If a program already has a variable or function with the same name as the one imported via the module, the imported object will overwrite the existing variable or function, leading to potential name clashes because there cannot be two variables with the same name in one namespace.