Python: Can subclasses overload inherited methods?
Posted
by Rosarch
on Stack Overflow
See other posts from Stack Overflow
or by Rosarch
Published on 2010-03-08T00:38:34Z
Indexed on
2010/03/08
0:52 UTC
Read the original article
Hit count: 381
I'm making a shopping cart app in Google App Engine. I have many classes that derive from a base handler:
class BaseHandler(webapp.RequestHandler):
def get(self, CSIN=None):
self.body(CSIN)
Does this mean that the body()
method of every descendant class needs to have the same argument? This is cumbersome. Only one descendant actually uses that argument. And what about when I add new args? Do I need to go through and change every class?
class Detail(BaseHandler):
def body(self, CSIN):
class MainPage(BaseHandler):
def body(self, CSIN=None): #@UnusedVariable
class Cart(BaseHandler):
def body(self, CSIN): #@UnusedVariable
© Stack Overflow or respective owner