I'm a big fan of this. I really want structural subtyping for http://github.com/google/pytype.
On Mon, Mar 20, 2017 at 5:00 AM, Ivan Levkivskyi <levkivs...@gmail.com> wrote: > Explicitly declaring implementation > ----------------------------------- > > To explicitly declare that a certain class implements the given protocols, > Why is this necessary? The whole point of ducktyping is that you *don't* have to declare what you implement. I get that it looks convenient to have your protocol A also supply some of the methods you'd expect classes of type A to have. But completing an implementation in that way should be done explicitly (via including a utility class or using a decorator like functools.total_ordering), not as side-effect of an (unnecessary) protocol declaration.
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com