Greg Ewing writes:
 > On 16/04/22 10:46 pm, Steven D'Aprano wrote:

 > > There is no *guessing* in the C3 linearization algorithm.
 > 
 > "Guessing" in the context of that Zen line means making an arbitrary
 > choice that may or may not be what the programmer wants. It doesn't
 > mean choosing at random.

Every feature means making an arbitrary choice that may or may not be
what the programmers wanted.  That's why we sometimes rewrite stuff in
C: because most applications of "such stuff" we want time or space
performance more than we want the dynamic power of Python.  But we
have a requirement (at least a strong suggestion) that where possible
C modules should also provide Python implementations so that people
who want the power of Python can have it, at some cost in performance.
So in the context of the Zen, I suggest we "refuse to guess" *because*
that arbitrary choice also forecloses (or at least makes very
difficult) other choices.  Otherwise, that Zen would discourage adding
any features at all!

But to me, C3 is hardly arbitrary.  The technical sense in which a
deterministic algorithm doesn't guess is irrelevant to the Zen, as you
point out.  But I don't think that's what Steven meant.  Someone wrote
that C3 is based on 5 requirements, which could also be considered
assumptions about what the programmer wants.  I don't recall what they
are exactly, but they seemed really plausible to me as a guide to what
most programmers would want, or at least find acceptable, most of the
time.  If you're going to call something even in the event of multiple
definitions, C3 has benefits (I don't have time to enumerate them
right now).  I don't think that's an arbitrary guess, and I think
that's what Steven meant.

But still, what if that's not what the programmer wants?  Can they get
what they want, *as easily as if the feature didn't exist*?  How often
does it happen that they can't?  I haven't seen any compelling answers
to those questions, only cooked-up toy programs whose only known use
is to give the answer "yes" to the question "can I find a program
where super() and/or C3 can't do the thing I arbitrarily prespecify
that the program must do?", and one (1) hearsay story whose "harm" is
perfectly well redressed by "OK, don't fix what ain't broke, then".

Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/63GGODAVSDZKSNK33SXYZZQFFLN7HY3F/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to