10
biskus
9y

that feeling every time you have to override a parent function and call super in python

Comments
  • 1
    Like using !important in CSS lol, I always feel so dirty
  • 2
    @Nojil I disagree.... Calling super means that you want the parent implementation as well. In other words it lets you extend the parent's implementation. Do more while retaining the normal behavior without having to rewrite it.
  • 1
    You *can* refactor if you don't like calling super, and the method in the parent class is meant to be overridden. Have the parent method do its thing, and then call a do-nothing hook method. Subclass can override the hook method, without having to call super.
  • 0
    @WannabeCalvin you just broke the internet man, thats genious
  • 0
    @biskus That's basically what's known as a "template method"
Add Comment