Is this duck-typing in Python?
问题 Here is some Ruby code: class Duck def help puts "Quaaaaaack!" end end class Person def help puts "Heeeelp!" end end def InTheForest x x.help end donald = Duck.new john = Person.new print "Donald in the forest: " InTheForest donald print "John in the forest: " InTheForest john And, I translated it to Python: import sys class Duck: def help(): print("Quaaaaaack!") class Person: def help(): print("Heeeelp!") def InTheForest(x): x.help() donald = Duck() john = Person() sys.stdout.write("Donald