
#411: Things I Wish Someone Had Explained To Me Sooner About Python
Talk Python To Me
00:00
How to Use Static Duct Typing in Python With Protocols
I would say the most extreme example of duck typing in Python, maybe a couple areas and they all seem to involve a revolve around the magic methods or the Python data types. So I could have a function, which I could call, or I could having a class that implements Dunder call is a callable, but it's actually an instance of an object. Right? And there's no real type that disambiguates those two things. But they work just fine. You know, another one would be, I have a list I can iterate, or I have something that implements the iterator pattern through the Dunder Methods. Like the Dunderiterator and so on. Yeah
Transcript
Play full episode