News for hackers. Stuff that matters.
Re:Interfaces and Protocols in Python by carlosf on Friday March 19, 2021 @12:54PM (#26515621)
I've recently found about Protocol / structural subtyping in Python and found this sort of pattern really useful as duck typing is so common in py code.

Highly recommend reading:

https://www.python.org/dev/peps/pep-0544/

https://docs.python.org/3/library/typing.html#nominal-vs-str...

https://docs.python.org/3/library/typing.html#typing.Protoco...

Cool example:

https://github.com/jordaneremieff/mangum/blob/main/mangum/ty...

There are no comments on this comment yet.