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._

Re: read-only attributes

2006-02-10 Thread john peter
Thank you for the suggestion!bruno at modulix <[EMAIL PROTECTED]> wrote: limodou wrote:> On 2/10/06, john peter wrote:(snip)>> what do i have to do if i want my application code to have>>read-only>> attributes?>>> I think you may consider property() built-in function:> > property( [fget[, fset[,

Re: read-only attributes

2006-02-10 Thread bruno at modulix
limodou wrote: > On 2/10/06, john peter <[EMAIL PROTECTED]> wrote: (snip) >> what do i have to do if i want my application code to have >>read-only >> attributes? >> > I think you may consider property() built-in function: > > property( [fget[, fset[, fdel[, doc) > > Return a property attrib

Re: read-only attributes

2006-02-09 Thread limodou
On 2/10/06, john peter <[EMAIL PROTECTED]> wrote: > while reading the lib manual, i came across mentions of read-only > attributes. > for example, a method has a read-only attribute (called _im_self ?) for > binding > a class instance to the method. is such a facility available to custom > applic