Re: Setting a read-only attribute

2007-08-31 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Aug 31, 6:14 pm, Alexandre Badez <[EMAIL PROTECTED]> wrote: >> On Aug 30, 11:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> >> wrote: >> >>> I have an object and wish to set an attribute on it which, >>> unfortunately for me, is read-only. >>> How can I go about this?

Re: Setting a read-only attribute

2007-08-31 Thread [EMAIL PROTECTED]
On Aug 31, 6:14 pm, Alexandre Badez <[EMAIL PROTECTED]> wrote: > On Aug 30, 11:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > I have an object and wish to set an attribute on it which, > > unfortunately for me, is read-only. > > > How can I go about this? > > > Cheers. > > -T > > Cou

Re: Setting a read-only attribute

2007-08-31 Thread Steve Holden
[EMAIL PROTECTED] wrote: > I have an object and wish to set an attribute on it which, > unfortunately for me, is read-only. > > How can I go about this? > This seems like a bizarre requirement. Why is the attribute read-only in the first place? How is the read-only mechanism enforced? Is the obj

Re: Setting a read-only attribute

2007-08-31 Thread Alexandre Badez
On Aug 30, 11:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have an object and wish to set an attribute on it which, > unfortunately for me, is read-only. > > How can I go about this? > > Cheers. > -T Could you show the object you want to set his attribute? Until that, it's difficult

Re: Setting a read-only attribute

2007-08-30 Thread James Stroud
[EMAIL PROTECTED] wrote: > I have an object and wish to set an attribute on it which, > unfortunately for me, is read-only. > > How can I go about this? Can you simply subclass the object's class, intercept __setattr__ and __getattribute__, and spoof the read-only attribute? E.g.: class A(objec

Re: Setting a read-only attribute

2007-08-30 Thread Gerardo Herzig
[EMAIL PROTECTED] wrote: >I have an object and wish to set an attribute on it which, >unfortunately for me, is read-only. > >How can I go about this? > >Cheers. >-T > > > I guess we all need an code example to show us the way 'read only' is implemented. If you cant access to the class wich you

Re: Setting a read-only attribute

2007-08-30 Thread Wildemar Wildenburger
Arnaud Delobelle wrote: > On Aug 30, 10:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: >> I have an object and wish to set an attribute on it which, >> unfortunately for me, is read-only. > > If it's read-only then you can't set it! > >> How can I go about this? > > Joke aside, I think

Re: Setting a read-only attribute

2007-08-30 Thread Arnaud Delobelle
On Aug 30, 10:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have an object and wish to set an attribute on it which, > unfortunately for me, is read-only. If it's read-only then you can't set it! > How can I go about this? Joke aside, I think you need to be more specific. -- Arnaud