Home

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@jabber.org
(See http://ime.webhop.org for ICQ, MSN, etc.)

previous
next

Something in the function tutorial confused me.
Re: super() doesn't get superclass
Re: Runtime optional interface
Re: lines of code
Re: parsing a dbIII file
Fundacja Hobbit
Krwinka
Akogo
Fundacja Sloneczko
Niechciane i Zapomniane