need help with properties

2009-05-09 Thread Esmail
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

Re: need help with properties

2009-05-09 Thread Scott David Daniels
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:

Re: need help with properties

2009-05-09 Thread Steven D'Aprano
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

Re: need help with properties

2009-05-09 Thread Esmail
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

Re: need help with properties

2009-05-09 Thread Esmail
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

Re: need help with properties

2009-05-09 Thread Scott David Daniels
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

Re: need help with properties

2009-05-09 Thread Esmail
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