I'm relatively new to python and I've run into this problem.

DECLARING CLASS

        class structure:
                def __init__(self, folders = []):        
                self.folders = folders
        
        def add_folder(self, folder):
        self.folders.append(tuple(folder))



Now I try to make an instance of this class

        structure1 = structure()
        structure1.add_folder([('foo'),])
        print structure1.folders

This returns: [('foo',)]

This works fine. But when I try to make another instance of that class...

        structure2 = structure()
        print structure2.folders

This now also returns: [('foo',)]
Even though I haven't added any folders to this new instance

What am I doing wrong?

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to