[Tutor] How does one construct a module for import?

Alan Gauld alan.gauld at btinternet.com
Mon Jun 2 15:52:42 CEST 2014


On 02/06/14 13:21, Sydney Shall wrote:

> I do not really understand what Steven is recommending below.
> Is it an init statement in a file or is it an independent file.

It is an independent file (which can be empty) whose existence
indicates to python that a folder is a package.

Thus if you have a folder abc which contains files a,b and c.
Even if abc is in Python's import path you cannot
import a,b or c unless there is an __init__.py

HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list