Any syntactic cleanup likely for Py3? And what about doc standards?
Torsten Bronger
bronger at physik.rwth-aachen.de
Thu Sep 6 01:04:55 EDT 2007
Hallöchen!
Alan Isaac writes:
> Torsten Bronger wrote:
>
> [...]
>
>> Their only flaw is that they are not "virtual" (in C++ speak).
>> In other words, you can't pass a "self" parameter to them.
>
> http://www.kylev.com/2004/10/13/fun-with-python-properties/
Thanks, I knew the possibility of using another level of indirection
vir explicit __set and __get methods but I haven't seen a solution
with lambda yet. I think on ActiveState's Python Cookbook site
there was a quite longish solution, too.
Then I formulate it more precisely: The "self" parameter is passed
to the setters and getters, however, it is not used for calling the
"correct" ones. "Correct" seems to be in the eye of the beholder:
The Python designers apparently intentionally chose this odd
"semi-static" behaviour of "property". But I think a fully virtual
behaviour would fit better into the Python mentality, it is easier
to explain, and it has more use cases.
Tschö,
Torsten.
--
Torsten Bronger, aquisgrana, europa vetus
Jabber ID: bronger at jabber.org
(See http://ime.webhop.org for ICQ, MSN, etc.)
More information about the Python-list
mailing list