[Python-ideas] A proper way to bring real interfaces to Python

Chris Angelico rosuav at gmail.com
Wed May 8 05:36:57 EDT 2019


On Wed, May 8, 2019 at 7:30 PM Serge Matveenko <s at matveenko.ru> wrote:
>
> On Tue, May 7, 2019 at 2:45 AM Steven D'Aprano <steve at pearwood.info> wrote:
> >
> > On Sun, May 05, 2019 at 04:23:58AM +0300, Serge Matveenko wrote:
> >
> > > So, I would like to propose adding a third main object called
> > > `interface` in addition to `object` and `type` and to use it to define
> > > interface objects.
> >
> > Having read this thread, I think the proposal is complex enough that
> > you will need to write a PEP explaining the nature of interfaces, the
> > problem with the status quo, and your suggested solution.
>
> I'd be happy to do that. Would you like to sponsor such a PEP?

When you come to write it up, I hope you can go into some detail about
what you mean by "a third main object". Currently, the hierarchy is
reentrant at the apex ("object" is an instance of "type", and "type"
is a subclass of "object"); where would "interface" fit in? Would it
be a type? Would it be an object? Will both type and interface be
subclasses of a BaseType, same as we have with exceptions?

ChrisA


More information about the Python-ideas mailing list