Dynamic Typing & Dynamic Binding in Python
Dynamic typing means a variable's type is determined at runtime by whatever value it currently holds, not fixed in advance — already seen throughout this course every time a variable was reassigned to a different type. Dynamic binding (also called late binding) is the related idea that which actual method runs is decided at the moment it's called, based on the object's real type, not decided ahead of time when the code was written. Together, these two are what make polymorphism work without any extra effort in Python.
A variable's type is just its current value's type
Reassigning changes it freely, with no declaration to update.
The same name can point to different kinds of objects
Over its lifetime, one variable can hold a number, then a string, then anything else.
Method calls are resolved at call time
Python looks up which actual method to run at that exact moment, based on the object's real class.
This lookup happens fresh every call
Never decided once and cached ahead of time.
This is what makes polymorphism automatic
Calling the same method name on different objects correctly runs each one’s own version.
def show_type(value): print(type(value).__name__) show_type(42)show_type("hello")show_type([1, 2, 3]) class Cat: def speak(self): print("Meow") class Dog: def speak(self): print("Woof") for animal in [Cat(), Dog()]: animal.speak()Recommended resourcesAffiliate links · may earn us a commission
Recommended for learners
Practice what you learned
Re-implement each visualized algorithm in Python yourself — building beats watching.