On Fri, Jun 14, 2019 at 10:45:17AM -0700, Brett Cannon wrote:

> I think the logic breaks down with multiple inheritance. If you make C(A,
> B), then you can say C > A and C > B, but then you can't say A > B or A < B
> which breaks sorting.

Just like sets, or floats, or anything other type that doesn't implement 
a total order. In practice, when was the last time you got bitten by the 
fact that sorting of sets or arbitrary floats is "broken"?



> If you want to know if a B inherits from Base, then I think `Base in
> B.mro()` will cover that just as succinctly.

I wonder why we have issubclass when we can check the mro ourselves.

Actually I've often wondered why we have both type.__mro__ and 
type.mro() and what the difference is.

I don't think that "Base in B.mro()" (15 chars) is just as succinct as 
"Base >= B" (9 chars). And the strict parent check is worse:

Base != B and Base in B.mro()" (29 chars)

"Base > B" (8 chars, 6 if you leave out the spaces)

It is hard to beat operators for succinctness.

But I don't think the advantage of this is in minimizing the number of 
characters that need to be typed. I think the advantage is that people 
already think of parent/child class relationships in terms of > symbol 
representing superclass > subclass relationships.

The big question in my mind is not whether this is good, useful, 
obvious syntax. I think it is. The question is whether it is good and 
useful *enough* to justify the feature.


-- 
Steven
_______________________________________________
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/EOETHKH6VV4VAUAZFH7LKSI2O4QWIY33/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to