On Mon, Mar 29, 2021 at 7:35 AM Nick Coghlan <ncogh...@gmail.com> wrote:
> On Mon, 29 Mar 2021, 7:47 pm Mark Shannon, <m...@hotpy.org> wrote: > > [Guido wrote] > >> > >> > Also, I think that we should probably separate this out in two separate >> > flag sets, one for subjects and one for class patterns -- it is pretty >> > confusing to merge the flag sets into a single value when their >> > applicability (subject or class pattern) is so different. >> >> That would require two different special attributes, which adds bulk >> without adding any value. >> >> __match_kind__ = MATCH_SEQUENCE | MATCH_DEFAULT >> >> should be clear to anyone familiar with integer flags. >> > > The combined flags might be clearer if the class matching flags were > "MATCH_CLS_DEFAULT" and "MATCH_CLS_SELF" > > Without that, it isn't obvious that they're modifying the way class > matching works. > > Alternatively, given Guido's suggestion of two attributes, they could be > "__match_container__" and "__match_class__". > > The value of splitting them is that they should compose better under > inheritance - the container ABCs could set "__match_container__" > appropriately without affecting the way "__match_class__" is set. > +1 An implementation might flatten them out at class definition time for > optimisation reasons, but it wouldn't need to be part of the public API. > Since the two flag sets are independent the bult is only apparent. Few classes would need to set one of these, let alone two. In the C layer they may be combined as part oftp_flags (assuming there are enough free bits). -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@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/GI46CSIUQDKYD7I4LXR2CYGYLSSG7B5N/ Code of Conduct: http://python.org/psf/codeofconduct/