Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python override inherited method class model constructor

class Bar(object):
   def __init__(self, arg1=None, arg2=None, argN=None):
       print arg1, arg2, argN

class Foo(Bar):
    def __init__(self, my_new_arg=None, **kwds):
       super(Foo, self).__init__(**kwds)
       self.new_arg = my_new_arg
       print my_new_arg

f = Foo(my_new_arg='x', arg2='y')
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #override #inherited #method #class #model #constructor
ADD COMMENT
Topic
Name
2+1 =