Lucasm writes:
> Thanks for the answers. I would like to override the property though
> without making special modifications in the main class beforehand. Is
> this possible?
That will not be easy. When you access obj.return_five, python looks up
'return_five' in type(obj) to see what the retur
On 10/20/2010 9:59 AM, Lucasm wrote:
Thanks for the answers. I would like to override the property though
without making special modifications in the main class beforehand. Is
this possible?
Take a look at http://docs.python.org/reference/datamodel.html#descriptors
The last paragraph of Sec
On 20 Okt, 16:09, Peter Otten <__pete...@web.de> wrote:
> Lucasm wrote:
> > On 19 Okt, 18:28, Steven D'Aprano > cybersource.com.au> wrote:
> >> On Tue, 19 Oct 2010 06:39:56 -0700, Lucasm wrote:
> >> > Hi,
>
> >> > A question. Is it possible to dynamically override a property?
>
> >> > class A(obje
Lucasm wrote:
> On 19 Okt, 18:28, Steven D'Aprano cybersource.com.au> wrote:
>> On Tue, 19 Oct 2010 06:39:56 -0700, Lucasm wrote:
>> > Hi,
>>
>> > A question. Is it possible to dynamically override a property?
>>
>> > class A(object):
>> > @property
>> > def return_five(self):
>> > return 5
>>
>>
On 19 Okt, 18:28, Steven D'Aprano wrote:
> On Tue, 19 Oct 2010 06:39:56 -0700, Lucasm wrote:
> > Hi,
>
> > A question. Is it possible to dynamically override a property?
>
> > class A(object):
> > @property
> > def return_five(self):
> > return 5
>
> > I would like to override the
On 19 Okt, 16:07, Benjamin Peterson wrote:
> Lucasm gmail.com> writes:
>
> > I would like to override the property for an instance of A to say the
> > string 'bla'.
>
> A.return_five = "blah"
I guess you did not test that. :)
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 19 Oct 2010 06:39:56 -0700, Lucasm wrote:
> Hi,
>
> A question. Is it possible to dynamically override a property?
>
> class A(object):
> @property
> def return_five(self):
> return 5
>
> I would like to override the property for an instance of A to say the
> string 'bla
On 10/19/2010 9:39 AM, Lucasm wrote:
Hi,
A question. Is it possible to dynamically override a property?
class A(object):
@property
def return_five(self):
return 5
I would like to override the property for an instance of A to say the
string 'bla'.
Is this the sort of thing
Lucasm gmail.com> writes:
> I would like to override the property for an instance of A to say the
> string 'bla'.
A.return_five = "blah"
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
A question. Is it possible to dynamically override a property?
class A(object):
@property
def return_five(self):
return 5
I would like to override the property for an instance of A to say the
string 'bla'.
--
http://mail.python.org/mailman/listinfo/python-list
10 matches
Mail list logo