Duck Typing
Duck Typing — Duck typing is a programming style where an object's suitability is determined by its behavior (methods and properties) rather than its explicit type. If it walks like a duck and quacks like a duck, it's a duck. Python embraces duck typing — you don't need to check the type of an object before calling its methods. This enables polymorphism without inheritance. Python's protocols (like `__iter__` for iterables) formalize duck typing through special methods. This term relates to the Built-in Functions category of the reference. You will meet duck typing in practice when working with APIs such as print(), len(), range(), type(). Related terms: Decorator, Generator, Context Manager, GIL (Global Interpreter Lock), List Comprehension, Mutable vs Immutable. Understanding duck typing makes the rest of the Python documentation noticeably easier to follow, because the concept recurs across function references, guides, snippets, and error messages you will meet in real projects.