+1. I also don’t see what’s the big deal.

On Wed, Mar 31, 2021 at 19:27 Caleb Donovick <donovick@cs.stanford.edu> wrote:
> It's a stronger statement than simply undoing
> the declaration that it's a sequence. There would be no way to reset
> to the default state.

How is this different from anything else that is inherited? 

The setting of a flag to `False` is not some irreversible process which permanently blocks child classes from setting that flag to `True`.
If I want to give priority to `Seq` over `Parent` in Brandt's original example I need only switch the order of inheritance so that `Seq` is 
earlier in `Child` MRO or explicitly set the flag to `True` (or  `Seq.__match_seq__`).  In contrast Brandt's scheme does irreversibly 
set flags, there is no way to undo the setting of `__match_seq__` in a parent class.  

This really doesn't seem like an issue to me.  I can't personally think of a use case for explicitly setting a flag to `False`
 but I also don't see why it should be forbidden. We get "- Otherwise, set the flag if any of the parents set have the flag set" 
for free through normal MRO rules except in the case where there is an explicit `False` (which I assume will be exceedingly rare 
and if it isn't there is clearly some use case).  Why make it more complicated?

On Wed, Mar 31, 2021 at 6:05 PM Chris Angelico <rosuav@gmail.com> wrote:
On Thu, Apr 1, 2021 at 11:54 AM Caleb Donovick <donovick@cs.stanford.edu> wrote:
>
> > Here, `Child` will *not* match as a sequence, even though it probably should,
>
> Strong disagree,  if I explicitly set `__match_seq__` to `False` in `Parent` I probably have a good reason for it and would absolutely expect `Child` to not match as a sequence.
>

How much difference is there between:

class Grandparent:
    """Not a sequence"""
class Parent(Grandparent):
    """Also not a sequence"""
class Child(Parent):
    """No sequences here"""

and this:

class Grandparent(list):
    """Is a sequence"""
class Parent(Grandparent):
    """Explicitly not a sequence"""
    __match_seq__ = False
class Child(Parent):
    """Shouldn't be a sequence"""


? Either way, Parent should function as a non-sequence. But if Child
inherits from both Parent and tuple, it is most definitely a tuple,
and therefore should be a sequence.

With your proposed semantics, setting __match_seq__ to False is not
simply saying "this isn't a sequence", but it's saying "prevent this
from being a sequence". It's a stronger statement than simply undoing
the declaration that it's a sequence. There would be no way to reset
to the default state.

Brandt's proposed semantics sound complicated, but as far as I can
tell, they give sane results in all cases.

ChrisA
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/GKOUSL2CPMO7NPPTK2E7XE7LXTPDVRDJ/
Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/UWSPAA27Q2ZE44YHK7ZKQCO5YZ2HG32F/
Code of Conduct: http://python.org/psf/codeofconduct/
--
--Guido (mobile)