Re: Read Only attributes, auto properties and getters and setters

2009-02-12 Thread josh logan
On Feb 12, 12:27 pm, TechieInsights wrote: > Ok... for some closure I have written a class to automate the > process.  It takes getters and setters and deleters and then sets the > property automatically.  Sweet! > > class AutoProperty(type): >         def __new__(cls, name, bases, methoddict): >

Re: Read Only attributes, auto properties and getters and setters

2009-02-12 Thread TechieInsights
Ok... for some closure I have written a class to automate the process. It takes getters and setters and deleters and then sets the property automatically. Sweet! class AutoProperty(type): def __new__(cls, name, bases, methoddict): processed = [] getter =

Re: Read Only attributes, auto properties and getters and setters

2009-02-12 Thread TechieInsights
On Feb 12, 9:27 am, josh logan wrote: > On Feb 12, 10:58 am, TechieInsights wrote: > > > > > Oh... one other thing that would be really cool is to do this with AOP/ > > descriptors!  I just haven't been able to get that to work either. > > Basics... > > > @readonly > > class MyClass(object): > >

Re: Read Only attributes, auto properties and getters and setters

2009-02-12 Thread josh logan
On Feb 12, 10:58 am, TechieInsights wrote: > Oh... one other thing that would be really cool is to do this with AOP/ > descriptors!  I just haven't been able to get that to work either. > Basics... > > @readonly > class MyClass(object): >         def __init__(self, x): >                 self.set_x

Re: Read Only attributes, auto properties and getters and setters

2009-02-12 Thread TechieInsights
Oh... one other thing that would be really cool is to do this with AOP/ descriptors! I just haven't been able to get that to work either. Basics... @readonly class MyClass(object): def __init__(self, x): self.set_x(x) def get_x(self): return self._