Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 1
    There's a bit more to it - as mentionned by the OP, run() has a lot of common code before and after the line that computes and set self.y and you certainly don't want to copy-paste the whole damn thing just to change one line. Commented Jun 24, 2019 at 15:23
  • 1
    @brunodesthuilliers Although you're right, I was able to use this answer (and the idea of overwriting a method) to arrive at the first solution you offered in your solution. Commented Jun 24, 2019 at 16:01
  • 1
    @Ralph well that's not much of a surprise actually - as I stated in my answer, "template method" is one of the most obvious OO design patterns ;-) Commented Jun 25, 2019 at 7:05