Whenever you do "from 'x' import 'y'" I was wondering which one is considered the 'module' and which is the 'package', and why it isn't the other way around?
Tell me more
×
Programmers Stack Exchange is a question and answer site for
professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.
|
|
A Python module is simply a Python source file, which can expose classes, functions and global variables. When imported from another Python source file, the file name is treated as a namespace. A Python package is simply a directory of Python module(s). For example, imagine the following directory tree in /usr/lib/python/site-packages:
So then you would do:
or
|
|||||
|