I\'ve seen some Python programmers use the following style fairly consistently (we\'ll call it style 1):
import some_module
# Use some_module.some_identifier in
I usually use a threshold to decide this. If I want to use a lot of things within some_module
, I'll use:
import some_module as sm
x = sm.whatever
If there's only one or two things I need:
from some_module import whatever
x = whatever
That's assuming I don't need a whatever
from some_other_module
, of course.
I tend to use the as
clause on the imports so that I can reduce my typing and substitue another module quite easily in the future.