Hi,
I am just reading about properties in Python. I am thinking
of this as an indirection mechanism, is that wrong? If so, how
come the getter/setters aren't called when I use properties
instead of the functions directly?
What am I missing here? I have a feeling I am overlooking
something
Esmail wrote:
I am just reading about properties in Python. I am thinking
of this as an indirection mechanism, is that wrong? If so, how
come the getter/setters aren't called when I use properties
instead of the functions directly?
Because you weren't actually using them. You were writing:
On Sat, 09 May 2009 11:30:02 -0400, Esmail wrote:
Hi,
I am just reading about properties in Python. I am thinking of this as
an indirection mechanism, is that wrong? If so, how come the
getter/setters aren't called when I use properties instead of the
functions directly?
What am I
hi Scott,
Scott David Daniels wrote:
Esmail wrote:
I am just reading about properties in Python. I am thinking
of this as an indirection mechanism, is that wrong? If so, how
come the getter/setters aren't called when I use properties
instead of the functions directly?
Because you weren't
Steven D'Aprano wrote:
All you've done in this second block is define a new object called size
and assign the tuple (3, 7) to it.
oops .. yes, you are right, and I am embarrassed...
[Aside: you might not be aware that it
is commas that make tuples, not brackets. The brackets are for
Esmail wrote:
Just curious, is there a way to pass more than one arg to a setter, or
do we always have use some sort of unpacking at the other end?
Think about the source for a setter. it comes from:
expr.name = expr
You could add optional args, but the option would never be taken.
If you
Scott David Daniels wrote:
... good stuff ...
the Python 3.X world is wisely losing the unpacking in parameter
passing trick.
Thanks Scott, useful information,
Esmail
--
http://mail.python.org/mailman/listinfo/python-list