Friday, December 26, 2014

import module vs ( from module import name1)

in python, statement like this one:

from module import name1, name2  # Copy these two names out (only)



is equivalent to this statement sequence:


import module                     # Fetch the module object
name1 = module.name1      # Copy names out by assignment
name2 = module.name2
del module


>> It means python interpreter will load entire module even if you want only few attributes of module.

No comments:

Post a Comment