Duck Typing in Python

As it is said in principle, “if it walks like a duck and quacks like duck, then it must be a duck”. If a class has behaviors required as expected, then be it and use it without worrying about its type.

For example,

class A:
    def work():
        print("work")
class B:
    def work():
        print("work")
 
def work(instance):
    instance.work()
 
work(A())
work(B())

Both works as fine.