On Mon, Jun 17, 2019 at 7:23 AM Rhodri James <rhodri@kynesim.co.uk> wrote:
On 16/06/2019 03:34, Guido van Rossum wrote:
> I don't actually know how viable this proposal is, but given that it's
> being debated at some length, I'd like to put in my  opinion that *if*
> we're going to define an operator that's (roughly) synonymous with
> issubclass(), it should be '<:', which is used in other languages (e.g.
> Scala) and notational systems (https://en.wikipedia.org/wiki/Subtyping).
> Overloading '<=' would be easier to implement, but would also cause enough
> confusion that I think we should avoid it at all cost.

I rather strongly disagree.  We are describing a fairly standard
incomplete ordering, which makes the comparison operators completely
appropriate.  Adding new syntax for something that doesn't need it is
the thing likely to cause confusion.

Indeed it would work the same way as set comparison does, if you interpret a type as the set of its instances.

But I imagine that many Python users are not so familiar with this abstraction level (even if they use isinstance() and issubclass() all day long). Sometimes using a *different* operator is helpful to send a signal to the reader that a *different* kind of thing is being manipulated -- sort of like how you can tell that a collection is a list or a set by noticing whether values are added using append() or add().

Type theorists apparently have chosen to use the <: notation, and presumably for the same reason.

--
--Guido van Rossum (python.org/~guido)
Pronouns: he/him/his (why is my pronoun here?)