On Apr 17, 7:19 pm, Visco Shaun <visc...@gmail.com> wrote: > What is the use of second import as the first import will be > enough(AFAIK) to access anything intended by the second import? > Is there any kind of advantage?
While Piet's explanation is correct for the logging module, you'll also see examples like: import os import os.path Where os.path _is_ accessible via the original os import. I believe that in this case, os.path is imported and stored against 'os.path', so any further references to it will be handled by the standard module lookup, rather than having to look up the 'os' import and then use getattr to reach path. I would expect that this is mostly of interest if you were using os.path.methods in an inner loop, to reduce the number of lookups. -- http://mail.python.org/mailman/listinfo/python-list