[Python-ideas] Discussion: Duck typing with “concepts”

Marko Ristin-Kaufmann marko.ristin at gmail.com
Wed Jan 23 02:04:24 EST 2019


Hi James,
As Ivan has mentioned, Protocols already allow for statical type checks:

https://mypy.readthedocs.io/en/latest/protocols.html

We didn't need protocols that often at Parquery, maybe half a dozen of
times?

While we didn't use them in Python, we had to use them intensively in Go
where it is a bit of a nightmare. It gives you freedom for cases when your
input arguments are fairly general (e.g., in a public library), but it made
refactoring our _production_ code (i.e. specific in contrast to general)
much harder since you couldn't look up easily which type implements which
"interface" (as protocols are called in Go).

Cheers Marko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190123/47a514cd/attachment-0001.html>


More information about the Python-ideas mailing list