referencing an object attribute sort of indirectly from within list

From: python newbie (mesteve_b_at_hotmail.com)
Date: 11/30/03


Date: Sun, 30 Nov 2003 01:32:05 GMT

Is there anything that would get in the way of me being able to reference an object attribute, from within a list.

I have:
 # one class here

  class BackupSet:
      fileGroupList = []
    
# another class here

 class FileGroup:
     sourceDir = ''
     destinDir = ''
     def __init__(self):
           self.sourceDir = 'c:\folder'
           self.destinDir = 'd:\folder'

fileGroup = FileGroup()

backupSet = BackUpSet()

backupSet.fileGroupList.append(fileGroup)

# when i try to reference an attribute here, I just get 'none'

print bkset.fileGroupList[0].sourceDir or
print "%s" % bkset.fileGroupList[0].sourceDir
    

thanks
Steve