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

Neil Girdhar mistersheik at gmail.com
Thu Jul 20 10:54:03 EDT 2017

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 <songofacandy at gmail.com> 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 Java's interface only wants (a).  (b) is unwanted side effect.

Right.  (b) is only unwanted because it requires metaclasses, and
metaclasses put constraints on inheritance.

I have switched to using the "AbstractBaseClass" class I defined above in
my own code.  If that is the sort of solution that will be undertaken, then
there is a question of what to call this class.

If instead, every class will get this functionality automatically (which is
more elegant), then someone needs to show that performance is unaffected.

Also, this whole thing might not be that important if (as Guido implies)
linters supplant this functionality.  Although, linters would not catch the
rare case where classes are programatically-generated.

> Additionally, even if CPython provide C implementation of ABCMeta,
> other Python implementations won't.
> So Abstract Class (not ABC) may be nice on such implementations too.
> I'm +1 to implement abc module in C.
> And I think (a) can be nice first step, instead of implement all at once.
> Regards,
> INADA Naoki  <songofacandy at gmail.com>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
> --
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "python-ideas" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/python-ideas/r2YLrIEQlig/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> python-ideas+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170720/7c01f807/attachment.html>

More information about the Python-ideas mailing list