Re: [Python-ideas] Fwd: Consider allowing the use of abstractmethod without metaclasses

2017-07-20 Thread INADA Naoki
> > I wonder if it would make sense to go further and merge *both* of these > features into regular classes. > > Checking for @abstractmethod in type.__new__ surely can't be that expensive, > can it? > But it affects startup time. It iterate all of the namespace and tries `getattr(obj,

Re: [Python-ideas] Fwd: Consider allowing the use of abstractmethod without metaclasses

2017-07-20 Thread INADA Naoki
INADA Naoki On Fri, Jul 21, 2017 at 2:59 AM, Ivan Levkivskyi wrote: > On 20 July 2017 at 19:51, INADA Naoki wrote: >> >> On Fri, Jul 21, 2017 at 12:12 AM, Ivan Levkivskyi >> wrote: >> > To be honest,

Re: [Python-ideas] Fwd: Consider allowing the use of abstractmethod without metaclasses

2017-07-20 Thread Nathaniel Smith
On Jul 20, 2017 05:39, "INADA Naoki" wrote: Hi, Victor. > Why not making abc faster instead of trying to workaround abc for perf > issue? Current ABC provides: a) Prohibit instantiating without implement abstract methods. b) registry based subclassing People want

Re: [Python-ideas] Fwd: Consider allowing the use of abstractmethod without metaclasses

2017-07-20 Thread Ivan Levkivskyi
On 20 July 2017 at 19:51, INADA Naoki wrote: > On Fri, Jul 21, 2017 at 12:12 AM, Ivan Levkivskyi > wrote: > > To be honest, I am not very happy with addition of a new special class. > > Imagine that the PEP 544 will be accepted (and I hope so). > >

Re: [Python-ideas] Fwd: Consider allowing the use of abstractmethod without metaclasses

2017-07-20 Thread INADA Naoki
On Fri, Jul 21, 2017 at 12:12 AM, Ivan Levkivskyi wrote: > To be honest, I am not very happy with addition of a new special class. > Imagine that the PEP 544 will be accepted (and I hope so). > Then we would have, abstract classes, abstract base classes, and protocols. > I

Re: [Python-ideas] Fwd: Consider allowing the use of abstractmethod without metaclasses

2017-07-20 Thread Ivan Levkivskyi
To be honest, I am not very happy with addition of a new special class. Imagine that the PEP 544 will be accepted (and I hope so). Then we would have, abstract classes, abstract base classes, and protocols. I think users will be overwhelmed by having three similar concepts instead of one. I think

Re: [Python-ideas] Fwd: Consider allowing the use of abstractmethod without metaclasses

2017-07-20 Thread Neil Girdhar
Good discussion so far. Please let me know if I can help with implementation or documentation. On Thu, Jul 20, 2017 at 8:40 AM INADA Naoki wrote: > Hi, Victor. > > > Why not making abc faster instead of trying to workaround abc for perf > > issue? > > Current ABC

Re: [Python-ideas] Fwd: Consider allowing the use of abstractmethod without metaclasses

2017-07-20 Thread INADA Naoki
Hi, Victor. > Why not making abc faster instead of trying to workaround abc for perf > issue? Current ABC provides: a) Prohibit instantiating without implement abstract methods. b) registry based subclassing People want Java's interface only wants (a). (b) is unwanted side effect.

Re: [Python-ideas] Fwd: Consider allowing the use of abstractmethod without metaclasses

2017-07-20 Thread Victor Stinner
Le 20 juil. 2017 3:49 AM, "INADA Naoki" a écrit : > I'm +1 with your idea in performance point of view. (...) But ABC is too heavy to use only for checking abstract methods. It uses three inefficient WeakSet [1] and it overrides isinstance and issubclass with slow Python