Re: DRY and class variables

2011-09-08 Thread egbert
On Thu, Sep 08, 2011 at 12:22:33PM +0200, Thomas Jollans wrote: > You should be able to do this with a metaclass (almost certainly > overkill), or with a class decorator (Python 2.6+): > > def with_metadata (cls): > cls.m = Metadata (cls.__name__) > cls.m.do_something () > return cls >

Re: DRY and class variables

2011-09-08 Thread Eric Snow
On Thu, Sep 8, 2011 at 3:55 AM, egbert wrote: > My classes correspond to sql tables. > In these classes I want to have several class variables > that refer to data that are common to all instances. > > The assignment statements for the class variables are the same > in all classes, except that of

Re: DRY and class variables

2011-09-08 Thread Thomas Jollans
On 08/09/11 11:55, egbert wrote: > My classes correspond to sql tables. > In these classes I want to have several class variables > that refer to data that are common to all instances. > > The assignment statements for the class variables are the same > in all classes, except that of these instruc

DRY and class variables

2011-09-08 Thread egbert
My classes correspond to sql tables. In these classes I want to have several class variables that refer to data that are common to all instances. The assignment statements for the class variables are the same in all classes, except that of these instructions needs the name of the class itself. Tha