Imports in classes??

Thomas Wouters thomas at xs4all.net
Sun Jul 16 11:24:47 EDT 2000


On Sun, Jul 16, 2000 at 03:11:03PM +0000, Martin Skøtt wrote:

> Im currently writing a database applikation using Python and
> PostgreSQL. Because I need both a GUI and a web interface i have
> chosen to divide the program in three classes (and files): one containing my
> database queryes and one for each interface type. But where would be
> the right place to import my database connection module (pygresql)? In
> each interface file or in the query file?
> I guess both solutions would would work, but what would be the "right
> thing"?

The right thing would be to do it when you need it. If you need the pygresql
module in each interface file (that is, you actually reference it), you will
have to put it in there. If you don't, well, don't :-) Don't import modules
you aren't going to use.

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list