by PilotPirx · 16y ago · 0 comments
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() + "!";No comments yet.