I\'ve tried to find a comprehensive guide on whether it is best to use import module
or from module import
. I\'ve just started with Python and I\'m
My own answer to this depends mostly on first, how many different modules I'll be using. If i'm only going to use one or two, I'll often use from
... import
since it makes for fewer keystrokes in the rest of the file, but if I'm going to make use of many different modules, I prefer just import
because that means that each module reference is self-documenting. I can see where each symbol comes from without having to hunt around.
Usuaully I prefer the self documenting style of plain import and only change to from.. import when the number of times I have to type the module name grows above 10 to 20, even if there's only one module being imported.