how are generic imports different from universal imports? aren’t they basically doing the same thing?
on the surface it might appear so, but there is a massive difference:
# generic import import math print math.sqrt(25) # universal import fom math import * print sqrt(25)
The universal import means a lot of names will be taken, which might result in naming conflict. If you do generic import, to access function of the module you have to
module.function_name. Makes it a lot easier to prevent naming conflict, which is a good thing especially if the project grows.
Always use generic import, unless you have a very very very good reason not to.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.