I'll follow this thread as well.... I choose the third method, the second didn't work when connection was dropped, or with sqlite...kept getting "connection is closed" after a while.
Il giorno giovedì 7 giugno 2012 23:42:33 UTC+2, Cliff Kachinske ha scritto: > > I'm just starting to use modules with classes for code commonality. > > I don't have a good feel for the most efficient way to, for example, pass > the db to a class method. I can think of three ways. > > - Pass it in when you call the method. > - Pass it in when you initialize the class > - Import current, do something like current.db = db and then pass current > to the class's __init__ > > Any opinions on this? All help greatly appreciated. >