Hacker News new | ask | show | jobs
by PilotPirx 5716 days ago
I don't see the point in this article. quote: "The developer has to figure out what the return types are for any methods that are called"

The developer has to figure out the return type in Python as well, since otherwise he wouldn't know, if the returned object provides the method he is calling on it next.

fido = puppies[0]

If puppies[0] doesn't return a "dog" the following call will fail. At run time!

Anyway, you can alternatively break up the code in several lines without creating a temporary variable for each step, if it's only about readability:

string fidos_name = spot.get_puppies()

               .puppies[0]

               .get_name()

               .upper() + "!";