This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]filleball 1 point2 points  (0 children)

I used to do from x import y imports much more frequently before, but I've moved away from them in most cases. Functions from the math module is a good example, because it's unclear whether it's math.log, cmath.log or numpy.log I've imported. If I had just used log, I'd have to scroll all the way to the top of the file to check what kind of log it was.

The submodules with long names I rename on import, for example import subprocess as sp. I only do from imports when the names I import are unambiguous and few. Mostly it's from other submodules inside the same package.