On 6/19/19 8:56 AM, Franklin? Lee wrote:
For example,
if (A <: B or A <: C) and A <: D:
This expression makes makes very clear the high-level logic being
used to determine the relationships between A, B, C, and D that is
being checked, and I just need to lookup what <: means
to understand the nature of the comparisons.
is not much better than
if issubclass(A, (B, C)) and issubclass(A, D):
This expression makes it very clear that a class hierarchy
relationship is being checked, but I still need to reach for the
reference manual to understand the semantics of a tuple being passed
as an argument to issubclass(). It is not at all
intuitive that
issubclass(A, (B, C))
means "Is A a subclass of B or a subclass of C?" when it could also
mean "Is A a subclass of both B and C?".
especially if you don't know what either of those mean. You can search
for issubclass, but you can't search for <:.
I generally find Google searches to be useless for most operators
and keywords in any language when you are looking for reference
information. It is generally faster to search for online reference
docs for the language and head straight to the index page. Now,
whether people remember how to use indexes in the age of "search for
everything" is another discussion altogether.
To show that you really do need the feature, you need to show the
complex expressions you write with issubclass that would be improved
by using an operator.
I agree, but as I pointed out above, it doesn't have to be very
complex. I think a real-world example written both ways would be
very helpful to the discussion.
--
-----------------------------------------
From there to here, from here to there,
funny things are everywhere.
-- Theodore Geisel