[Python-Dev] Extended Function syntax
Greg Ewing
greg@cosc.canterbury.ac.nz
Mon, 27 Jan 2003 16:38:55 +1300 (NZDT)
Martin Loewis:
> Is that a dislike towards the notation, or towards the
> implementation strategy.
The notation is the important thing to get right, I
suppose, since the implementation can be changed if
need be.
> there is a clean implementation for it, too (just provide the filter
> with a reference to the namespace-under-construction).
Yes, I can see that now (I was thinking that the property
mechanism itself would need changing, but it wouldn't).
But even so, I don't think it really works all that well
for properties. There would be something distinctly odd
about writing this sort of thing:
def foo(self) [get_property]:
...
def foo(self, x) [set_property]:
...
because it looks like you're defining two things both called
"foo". There would be too much hidden magic going on there for my
taste.
I've just had another thought: This would also make it hard
to do a text-editor search to answer questions such as
"where is the get-function for the foo property defined".
With my proposal you could search for "def foo.get".
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg@cosc.canterbury.ac.nz +--------------------------------------+