Bad idea.
issubclass() works well.
Adding operator support should be considered very carefully.
I prefer a good portion of conservatism for such changes.
How often the proposed change is needed?
It adds a new complexity (documenting, teaching etc) without real
benefits for daily jobs.
On Fri, Jun 14, 2019 at 9:42 PM Joao S. O. Bueno
And yet:
This is trivial to implement in a custom metaclass - and maybe it would make default type too "noisy".
I am -1 on this going into normal classes, and +0 for having a colaborative metaclass with __lt__, __eq__ and such implementing these on the stdlib. Maybe living in "types".
On Fri, 14 Jun 2019 at 14:53, 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.
If you want to know if a B inherits from Base, then I think `Base in B.mro()` will cover that just as succinctly. And if you need to know position you can compare indexes into the MRO.
On Fri, Jun 14, 2019 at 1:06 AM eminbugrasaral--- via Python-ideas
wrote: Let's assume you have this model:
``` class Base: pass
class A(Base): pass
class B(Base): pass
class C(A): pass ```
While we can do `A == B`, or `B == C` or `B == B`, I would expect to be able to compare like this as well: `A >= B (if B is subclass or itself of A)`, or `B <= C (if B is a subclass or itself of C)`
Because, since == means equality check. With the same logic, a class wraps another class is actually greater than this class from its type. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@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/6W7HCI... Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@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/IFW2UQ... Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@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/UYNPZX... Code of Conduct: http://python.org/psf/codeofconduct/
-- Thanks, Andrew Svetlov