[BangPypers] folder initialization issues
Saager Mhatre
saager.mhatre at gmail.com
Sun Sep 8 19:40:54 CEST 2013
On Thu, Aug 29, 2013 at 9:43 AM, Noufal Ibrahim <noufal at nibrahim.net.in>wrote:
> Anand Chitipothu <anandology at gmail.com> writes:
>
> [...]
>
> > Lets say you a python file x.py.
> > You can import it just using "import x".
> >
> > If you have y/x.py, you would import it using "import y.x" or "from y
> > import x". Here x is a submodule of y and y is also a module. But where
> is
> > the file for module y now? Since y is a folder, Python expects
> > y/__init__.py for module y. That is a convention that Python uses.
> >
> > So to use a folder as a module you need add __init__.py to it. Got it?
>
> [...]
>
> Also, directories as modules are often called packages.
> http://docs.python.org/2/tutorial/modules.html#packages
>
Not to be confused with python packages as packaged and distributed from a
package index like https://pypi.python.org
(ducks)
- d
More information about the BangPypers
mailing list