Well, what if you want to use both library A
and library B
with a function called f
? In Python this is super easy: you import both of these modules, and then you qualify correct f
s name with it's module, e.g. A.f()
This leads to the first advantage: namespaces (as a solution for name-clashing problem) and non-polluting global scope.
The second advantage is more flexible module system.