Re: a trick with lists ?

2008-02-07 Thread James Turk
On Feb 7, 12:20 pm, "Sébastien Vincent" free.fr> wrote: > I've found some class on the Net which takes basically this form : > > ## > class Foo: > def __init__(self): > self.tasks = [] >... > > def method1(self): > tasks = [] > while True: > ... > append

Re: one-time initialization of class members

2007-06-14 Thread James Turk
On Jun 13, 11:42 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > James Turk wrote: > > It actually occured to me that I could use a @classmethod to do the > > loading and take that out of the BaseClass constructor. What I have > > makes more sense and eliminates

Re: one-time initialization of class members

2007-06-13 Thread James Turk
On Jun 13, 9:03 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 13 Jun 2007 23:55:02 +0000, James Turk wrote: > > On Jun 13, 6:54 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > >> James Turk wrote: > >> > Hi, > > >> > I have a

Re: one-time initialization of class members

2007-06-13 Thread James Turk
On Jun 13, 8:00 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > James Turk wrote: > > Hi, > > > I have a situation where I have some class members that should only be > > done once. Essentially my problem looks like this: > > > class Base(object): > >

Re: one-time initialization of class members

2007-06-13 Thread James Turk
On Jun 13, 6:54 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > James Turk wrote: > > Hi, > > > I have a situation where I have some class members that should only be > > done once. Essentially my problem looks like this: > > > class Base(object): > &

one-time initialization of class members

2007-06-13 Thread James Turk
Hi, I have a situation where I have some class members that should only be done once. Essentially my problem looks like this: class Base(object): dataset = None def __init__(self, param): if type(self).dataset is None: # code to load dataset based on param, expensive