referencing an object attribute sort of indirectly from within list
From: python newbie (mesteve_b_at_hotmail.com)
Date: 11/30/03
- Next message: python newbie: "Re: Python Book"
- Previous message: Bruno Desthuilliers: "Re: Need some advice"
- Next in thread: Bengt Richter: "Re: referencing an object attribute sort of indirectly from within list"
- Reply: Bengt Richter: "Re: referencing an object attribute sort of indirectly from within list"
- Reply: Sean Ross: "Re: referencing an object attribute sort of indirectly from within list"
- Reply: python newbie: "Re: referencing an object attribute sort of indirectly from within list"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: python newbie: "Re: Python Book"
- Previous message: Bruno Desthuilliers: "Re: Need some advice"
- Next in thread: Bengt Richter: "Re: referencing an object attribute sort of indirectly from within list"
- Reply: Bengt Richter: "Re: referencing an object attribute sort of indirectly from within list"
- Reply: Sean Ross: "Re: referencing an object attribute sort of indirectly from within list"
- Reply: python newbie: "Re: referencing an object attribute sort of indirectly from within list"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]