Serge Matveenko writes:
 > On Sun, May 5, 2019 at 8:23 PM Stephen J. Turnbull
 > <turnbull.stephen...@u.tsukuba.ac.jp> 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 objects. Such interfaces could then be used in the class
 > >  > definition in the following way.
 > >
 > > How does this compare to existing technology such as zope.interface?
 > > Why do you want it to behave differently where it does?
 > 
 > `zope.interface` has a lot of functionality that is true. However, it
 > is just another hacky way to bring interfaces functionality to a
 > project. My proposal is to finally bring interfaces to Python.

Yes, I understand that, but it isn't responsive to my question.
zope.interface *does* "bring interfaces to Python", and it has a lot
of functionality already.  You haven't explained why zope.interfaces
is "hacky", nor why it would be so beneficial to have interface
support in the stdlib.

 > support to Python could greatly benefit to projects like
 > `zope.interface` as it would allow developers to write more reusable
 > code using core Python functionality

"Could" isn't enough to support "should".  Real-world examples would
help.  Eg, point to a stdlib module (which by definition only uses
core Python functionality) that could be easier to understand and/or
maintain with built-in 'interface' support.  (Feel free to assume
functionality that hasn't been implemented in 'strict-interface' yet,
and wave your hands a lot.)

The thing is, projects in one or a few files with few non-stdlib
imports just don't need interface support in my experience.  They're
small enough to keep in my head, and the overhead of defining
interfaces and implementing them separately is too great to be
worthwhile.  Type annotations are helpful in ensuring proper use of
classes and functions.  In larger projects, the overhead of importing
zope.interface is proportionately tiny, and well-worth the effort to
create and maintain interfaces that are heavier-weight than function
signatures.

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to