more elegant way when call parent method with the same name My subclass extends the Formatter class,
I wonder know is there any elegant way, to rewrite my code

Parent

class Formatter(object):
    def resp_in_hash(self, resp):
        ...
        return rtn_hash


Child

from formatter import Formatter
# -----------------------------------------------------------------
class Request(Formatter):

    def req(self, url_path, is_no_cache=True):
        ...
    def resp_in_hash(self, url_path):
        resp, content = self.req(url_path)
        return super(Request, self).resp_in_hash(content)
Two ways to rewrite it:

When you know which version of the method you want to call you can name it directly, but in that case need to pass self as an argument:

    return Formatter.resp_in_hash(self, content)


Not necessarily more elegant.



Python 3 introduced a new cleaner super format for the common case when you want to step up from the current class and pass self (the first argument):

    return super().resp_in_hash(content)


This only works in python 3, though.