Sep 1, 2018 · 1 min read
Don’t do this — and you particularly shouldn’t be doing this in a teaching article.
PEP-8, the bible of Python style, is very clear that this is a bad idea in almost all circumstances.
Why? Because you’ve just imported an unknown but probably large number of symbols into your namespace. If you accidentally use one of them instead of the variable name you needed, you’re going to get some value, and it won’t be what you expect, and you won’t get an error at that moment.
In the example, it’s particularly lame, because you save exactly one character of typing — from sh import sh is just one character longer.
Remember, the number two motto in the Zen of Python is “Explicit is better than implicit”!
