On Fri, Nov 10, 2017 at 10:26 PM, Ivan Levkivskyi <levkivs...@gmail.com> wrote:
> On 10 November 2017 at 21:19, Koos Zevenhoven <k7ho...@gmail.com> wrote: > >> On Fri, Nov 10, 2017 at 8:33 PM, Ivan Levkivskyi <levkivs...@gmail.com> >> wrote: >> >>> On 10 November 2017 at 18:39, Koos Zevenhoven <k7ho...@gmail.com> wrote: >>> >>>> On Wed, Sep 27, 2017 at 12:28 PM, Ivan Levkivskyi <levkivs...@gmail.com >>>> > wrote: >>>> >>>>> >>>>> >>>> >>>>> After creating the class, >>>>> the original bases are saved in ``__orig_bases__`` (currently this is >>>>> also >>>>> done by the metaclass). >>>>> >>>>> >>>> Those are *still* bases, right, even if they are not in the mro? I'm >>>> not sure if this is a naming thing or something even more. >>>> >>> >>> The objects that have __subclass_base__ method (proposed to rename to >>> __mro_entry__) >>> are removed from __bases__ attributed of the newly created class. >>> Otherwise they may cause a metaclass conflict. >>> One can however still call them syntactic (or static?) bases. For >>> example this is how it is going to be used by typing: >>> >>> from typing import List >>> >>> class Tokens(List[int]): >>> ... >>> >>> assert Tokens.__bases__ == (list,) >>> >> >> Why is List[int] not allowed to be the base? Neither method-lookup >> performance nor the metaclass conflict issue seem to depend on whether >> List[int] is in __bases__. >> >> > The situation is actually quite opposite. Interestingly, the whole > discussion started from Mark Shannon pointing to these problems with > List[int] at the Language Summit. > The original discussion on typing tracker is referenced in the PEP draft. > > What do you mean? I don't see any mention of __bases__ in the discussion. Perhaps related, if the syntax indeed were like this (as suggested by Mark?): @implements(List[int]) class Tokens(list): ... then I would expect List[int] to be in __implements__ or something like that. But how to interpret that? Maybe something like "List describes the interface/API that list has"? -- Koos -- + Koos Zevenhoven + http://twitter.com/k7hoven +
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/