I have a problem in inheritance with python.
I need to override a python function and whenever that class called it should call the child method not the parent.
Here is the code : in file called test_inherit.py
class test_me(object):
def get_uid(self, node):
return uid
and what i did is : in file called test_new.py
from test_inherit import test_me
class test_new(test_me)
def get_uid(self,node):
print "X is here",node
return uid
i need that when i call test_me class or test_new class , it should call the get_uid of test_new class but i don't know how to achieve that ?!
It's simple .. i have a project that has this class "test_me" which contain a function called get_uid ,, and that fuction is called in the project many times,i want to call the function of the child when ever the parent function is called because i don't want to change the main project ,, i want to do my edits in separate file .