P
python newbie
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
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