Using classes for the first time,help in debugging
<p>here is post my code:this is no the entire code but enough to explain my doubt.please discard any code line which u find irrelavent</p>

<pre><code>enter code here
saving_tree={}   
isLeaf=False
class tree:
    global saving_tree
    rootNode=None
    lispTree=None
    def __init__(self,x):
        file=x
        string=file.readlines()
        #print string
        self.lispTree=S_expression(string)
        self.rootNode=BinaryDecisionNode(0,'Root',self.lispTree)

class BinaryDecisionNode:
    global saving_tree     
    def __init__(self,ind,name,lispTree,parent=None):

        self.parent=parent

        nodes=lispTree.getNodes(ind)
        print nodes
        self.isLeaf=(nodes[0]==1)
        nodes=nodes[1]#Nodes are stored
        self.name=name
        self.children=[]
        if self.isLeaf: #Leaf Node
            print nodes
            #Set the leaf data
            self.attribute=nodes
            print "LeafNode is ",nodes
        else:            
            #Set the question
            self.attribute=lispTree.getString(nodes[0])
            self.attribute=self.attribute.split()


            print "Question: ",self.attribute,self.name
            tree={}
            tree={str(self.name):self.attribute}
            saving_tree=tree
            #Add the children
            for i in range(1,len(nodes)):#Since node 0 is a question
               # print "Adding child ",nodes[i]," who has ",len(nodes)-1," siblings"
                self.children.append(BinaryDecisionNode(nodes[i],self.name+str(i),lispTree,self))

        print saving_tree
</code></pre>

<p>i wanted to save some data in saving_tree{},which i have declared previously and want to use that saving tree in the another function outside the class.when i asked to print saving_tree it printing but,only for that instance.i want the saving_tree{} to have the data to store data of all instance and access it outside.
when i asked for print saving_tree outside the class it prints empty{}..
please tell me the required modification to get my required output and use saving_tree{} outside the class..</p>
