Alex Martelli wrote:
..
If (e.g.) __set__ needs to behave differently when applied to certain
instances rather than others, then it had better be messed with
(overridden) compared to property.__set__ since the latter has no such
proviso. Of course, your architecture as sketched below
Robin Becker wrote:
Kay Schluehr wrote:
Robin Becker wrote:
I thought that methods were always overridable.
In this case the lookup on the
class changes the behaviour of the one and only property.
How can something be made overridable that is actually overridable? I
didn't know
Kay Schluehr wrote:
Robin Becker wrote:
I thought that methods were always overridable.
In this case the lookup on the
class changes the behaviour of the one and only property.
How can something be made overridable that is actually overridable? I
didn't know how to better express the
On Tue, 18 Oct 2005 08:00:51 +, Robin Becker [EMAIL PROTECTED] wrote:
Bruno Desthuilliers wrote:
Robin Becker a écrit :
Is there a way to override a data property in the instance? Do I need
to create another class with the property changed?
Do you mean attributes or properties ?
I
Robin Becker [EMAIL PROTECTED] wrote:
...
in answer to Bengt Bruno here is what I'm sort of playing with. Alex
suggests class change as an answer, but that looks really clunky to me.
I'm not sure what
Changing class is indeed 'clunky', though it might have been necessary
depending on how
Robin Becker wrote:
I thought that methods were always overridable.
In this case the lookup on the
class changes the behaviour of the one and only property.
How can something be made overridable that is actually overridable? I
didn't know how to better express the broken polymorphism of
Steven Bethard wrote:
Robin Becker wrote:
...
Can you add the object to be observed as another parameter to the add
method?
py class ObservableProperty(property):
... def __init__(self, *args, **kwargs):
..
py A.x.add(b, obs2)
py b.x = 7
obs2: 7
Probably
Bruno Desthuilliers wrote:
Robin Becker a écrit :
Is there a way to override a data property in the instance? Do I need
to create another class with the property changed?
Do you mean attributes or properties ?
I mean property here. My aim was to create an ObserverProperty class
Robin Becker wrote:
Bruno Desthuilliers wrote:
Robin Becker a écrit :
Is there a way to override a data property in the instance? Do I need
to create another class with the property changed?
Do you mean attributes or properties ?
I mean property here.
Ok, wasn't sure... And sorry
Robin Becker [EMAIL PROTECTED] wrote:
Bruno Desthuilliers wrote:
Robin Becker a écrit :
Is there a way to override a data property in the instance? Do I need
to create another class with the property changed?
Do you mean attributes or properties ?
I mean property here. My aim
bruno modulix wrote:
.
Could you elaborate ? Or at least give an exemple ?
.
in answer to Bengt Bruno here is what I'm sort of playing with. Alex suggests
class change as an answer, but that looks really clunky to me. I'm not sure
what
Alex means by
A better design might be to
Robin Becker wrote:
Is there a way to override a data property in the instance? Do I need to
create
another class with the property changed?
--
Robin Becker
It is possible to decorate a method in a way that it seems like
property() respects overridden methods. The decorator cares
Kay Schluehr wrote:
Robin Becker wrote:
Is there a way to override a data property in the instance? Do I need to
create
another class with the property changed?
--
Robin Becker
It is possible to decorate a method in a way that it seems like
property() respects overridden methods
Robin Becker wrote:
## my silly example
class ObserverProperty(property):
def __init__(self,name,observers=None,validator=None):
self._name = name
self._observers = observers or []
self._validator = validator or (lambda x: x)
self._pName = '_' + name
Is there a way to override a data property in the instance? Do I need to create
another class with the property changed?
--
Robin Becker
--
http://mail.python.org/mailman/listinfo/python-list
Robin Becker a écrit :
Is there a way to override a data property in the instance? Do I need to
create another class with the property changed?
Do you mean attributes or properties ?
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 17 Oct 2005 18:52:19 +0100, Robin Becker [EMAIL PROTECTED] wrote:
Is there a way to override a data property in the instance? Do I need to
create
another class with the property changed?
How do you need to override it? Care to create a toy example with a
wish I could override action
17 matches
Mail list logo