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 the unecessary constructors. > > >

Re: one-time initialization of class members

2007-06-13 Thread Steven Bethard
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 the unecessary constructors. > > ie. > > class BaseClass: > @classmethod > def loadData(params):

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 +, James Turk wrote: > > 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

Re: one-time initialization of class members

2007-06-13 Thread Gabriel Genellina
En Wed, 13 Jun 2007 22:03:50 -0300, Steven D'Aprano <[EMAIL PROTECTED]> escribió: > On Wed, 13 Jun 2007 23:55:02 +, James Turk wrote: >>> James Turk wrote: >>> >>> > I have a situation where I have some class members that should only >>> be >>> > done once. Essentially my problem looks li

Re: one-time initialization of class members

2007-06-13 Thread Steven D'Aprano
On Wed, 13 Jun 2007 23:55:02 +, James Turk wrote: > 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

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): > > dataset = None > > > def __init__(self, p

Re: one-time initialization of class members

2007-06-13 Thread Larry Bates
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): > dataset = None > > def __init__(self, param): > if type(self).dataset is None: > # code t

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): > > dataset = None > > > def __init__(self

Re: one-time initialization of class members

2007-06-13 Thread Steven Bethard
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): > dataset = None > > def __init__(self, param): > if type(self).dataset is None: > # code t

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