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

2019-05-08 Thread Serge Matveenko
On Wed, May 8, 2019 at 12:37 PM Chris Angelico wrote: > 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");

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

2019-05-08 Thread Chris Angelico
On Wed, May 8, 2019 at 7:30 PM Serge Matveenko wrote: > > On Tue, May 7, 2019 at 2:45 AM Steven D'Aprano 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

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

2019-05-08 Thread Serge Matveenko
On Tue, May 7, 2019 at 2:45 AM Steven D'Aprano 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. > >

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

2019-05-07 Thread Stephen J. Turnbull
Serge Matveenko writes: > On Sun, May 5, 2019 at 8:23 PM Stephen J. Turnbull > wrote: > > > > Serge Matveenko writes: > > > > > 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

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

2019-05-06 Thread Steven D'Aprano
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

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

2019-05-06 Thread Serge Matveenko
On Mon, May 6, 2019 at 5:33 PM Ivan Levkivskyi wrote: > > On Mon, 6 May 2019 at 03:23, Serge Matveenko wrote: >> >> On Sun, May 5, 2019 at 8:23 PM Stephen J. Turnbull >> wrote: >> > >> > Serge Matveenko writes: >> > >> > > So, I would like to propose adding a third main object called >> > >

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

2019-05-06 Thread Ivan Levkivskyi
On Mon, 6 May 2019 at 03:23, Serge Matveenko wrote: > On Sun, May 5, 2019 at 8:23 PM Stephen J. Turnbull > wrote: > > > > Serge Matveenko writes: > > > > > So, I would like to propose adding a third main object called > > > `interface` in addition to `object` and `type` and to use it to

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

2019-05-05 Thread Stephen J. Turnbull
Serge Matveenko writes: > 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. Such interfaces could then be used in the class > definition in the following way. How does this compare to

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

2019-05-04 Thread Serge Matveenko
On Sun, May 5, 2019 at 6:42 AM Steven D'Aprano wrote: > It isn't that I *oppose* moving the checks to class-creation time > instead of instantiation time, but I'd like to hear more about why it is > a problem. This doesn't look like moving checks from one place to another for me. It is basically

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

2019-05-04 Thread Serge Matveenko
> Another one is that ABCs aren't interfaces at all as they all to have > actual implementations being encapsulated in them. This causes > misunderstandings of the code and strange behaviors like in > `collection.abc` module for instance where there is a lot of > implementation and some methods

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

2019-05-04 Thread Serge Matveenko
On Sun, May 5, 2019 at 6:42 AM Steven D'Aprano 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. Such

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

2019-05-04 Thread Serge Matveenko
On Sun, May 5, 2019 at 6:40 AM Ryan Gonzalez wrote: > > Worth maybe noting that this could play interestingly with PEP 484? You're right. It already plays along with type hints in different ways. At the moment it requires an exact match of implementation method signatures with the interface

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

2019-05-04 Thread Steven D'Aprano
On Sun, May 05, 2019 at 04:23:58AM +0300, Serge Matveenko wrote: > Hi, all! > > I believe, almost everybody is familiar with the `abc` package. > > The problem is that the ABC class is not a separate thing from > `object`. So, using ABCs often results in complicated inheritance > designs and

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

2019-05-04 Thread Ryan Gonzalez
Worth maybe noting that this could play interestingly with PEP 484? -- Ryan (ライアン) Yoko Shimomura, ryo (supercell/EGOIST), Hiroyuki Sawano >> everyone else https://refi64.com/ On May 4, 2019, 8:24 PM -0500, Serge Matveenko , wrote: > Hi, all! > > I believe, almost everybody is familiar with the

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

2019-05-04 Thread Serge Matveenko
Hi, all! I believe, almost everybody is familiar with the `abc` package. The problem is that the ABC class is not a separate thing from `object`. So, using ABCs often results in complicated inheritance designs and even in the infamous metaclass conflict. Another problem is that ABC performs