3 ms·
The more Python I write, the more I feel that "from foo import name1,name2,nameN" is The Way. Yes it's more verbose. Yes it loses any benefits of namespaces. Ho
by hoosieree 2y ago
The more Python I write, the more I feel that "from foo import name1,name2,nameN" is The Way. Yes it's more verbose. Yes it loses any benefits of namespaces. However it encourages you to focus on your actual problem rather than hypothetical problems you might have someday, and the namespace clashes might have a positive unintended consequence of making you realize you don't actually need that other library after all.
- water-your-self 2y ago> the namespace clashes might have a positive unintended consequence of making you realize you don't actually need that other library after all.
- hot_gril 2y agoIt's unlikely that two things with the same name in different packages do the same thing. It's also kinda unlikely that you have a collision in the first place. And if the theoretical problem with `import numpy as np` is that you forget what `np` is, then using `array` instead of `np.array` will have the same problem. At the end of the day, this is a minuscule issue either way. I won't import stuff your way, but if you hand me code like that, I won't change it.