Steve Holden wrote:
> "none <"@bag.python.org wrote:
> It seems particularly odd to want to put getters and setters behind
> property access. What does the extra layer buy you?
The purpose is that there is more to the accessors then I posted.
The setters do some 'mark dirty' bookeeping whenever
"none <"@bag.python.org wrote:
> I'm trying to implement a simple repeateable property mechansism so I
> don't have to write accessors for every single instance variable I have.
...
> Any ideas?
Yes, don't write accessors for every single instance variable you have.
In some languages that mig
Em Sáb, 2006-02-25 às 09:14 -0500, Steve Holden escreveu:
> It seems particularly odd to want to put getters and setters behind
> property access. What does the extra layer buy you?
I can only think of some kind of debugging. Maybe?
> regards
> Steve
Cya,
Felipe.
--
"Quem excele em empregar
André Malo wrote:
> * none wrote:
>
>
>>classMyObject:
>
> [...]
>
>
>>As you can see, the _getProperty() method gets called properly when I do
>> 'o.value' but 'o.value = 123' does not seem to use the property
>>stucture. I can't figure out why 'o.value=123' does not call
>>_setProperty()
André Malo wrote:
> * none wrote:
>
>
>>classMyObject:
>
> [...]
>
>
>>As you can see, the _getProperty() method gets called properly when I do
>> 'o.value' but 'o.value = 123' does not seem to use the property
>>stucture. I can't figure out why 'o.value=123' does not call
>>_setProperty()
"none <"@bag.python.org wrote:
> I'm trying to implement a simple repeateable property mechansism so I
> don't have to write accessors for every single instance variable I have.
Please don't do that. The Python way is to use direct access to instance
variables unless there's a good reason not to
* none wrote:
> classMyObject:
[...]
> As you can see, the _getProperty() method gets called properly when I do
> 'o.value' but 'o.value = 123' does not seem to use the property
> stucture. I can't figure out why 'o.value=123' does not call
> _setProperty()
>
> Any ideas?
property only wor
I'm trying to implement a simple repeateable property mechansism so I
don't have to write accessors for every single instance variable I have.
classMyObject:
def __init__ (self):
self.initialize()
def initialize(self):
self._value=None
def _setPrope
I've observed something strange about property docstrings and I'm
wondering if anyone here can clarify what's going on: if I create a class
derived from property, the docstrings of the instances end up being that
of the derived class, not the docstring passed into the property
constructor. Examp