Till now I have done only procedural programming in C so I am rather unclear about both OOP and Python.
I have a large project which contains a number of python files. File a.py defines a class called fobject I am using python 2.5
File b.py and c.py have classes called BProject and CProject which have an object of fobject as parameter. I have included using import CProject (defined in c.py) in b.py. I have a list in CProject which I fill using wx python GUI. Next I call a function BRun defined in BProject which internally calls a CRun Function in CProject ie. in c.py.
In this CRun I want to manipulate the list but list is always empty at this time. Why is this so?
What should I do given the constraint is I can't change anything a.py in which fobject is defined ?
file : c.py
def Instance(fObject):
return test_page_CProject(fObject)
class CProject(object):
def __init__(self, fObject):
self.fObj = fObject
self.IntList = []
##snip
def OnIntSelectBtnPress(self,parent):
print ":self.IntList"
print self.IntList
self.listBoxIntSelect.InsertItems(self.IntList,0)
print self.IntList
def OnIntRun(self):
IntLModeList = self.IntListIntMode
#snip
file b.py
def Instance(fObject):
return BProject(fObject)
class BProject(object):
def __init__(self, fObject):
self.FObj = fObject
#snip
Object = __import__('CProject')
#snip
self.intObject = Object.Instance(self.FObj)
self.intObject.OnIntRun()