referencing an object attribute sort of indirectly from within list
mesteve_b at hotmail.com
Sun Nov 30 13:34:59 CET 2003
Sorry about that, I retyped it because I was actually using dom to import an
xml file, and the nodes were used to populate the object attributes, not
the literal strings I was using. I didn't want to put the xml code in this
post. I also set my email to text only, so no more html.
"Bengt Richter" <bokr at oz.net> wrote in message
news:bqbnp2$i27$0 at 220.127.116.11...
> On Sun, 30 Nov 2003 01:32:05 GMT, "python newbie" <mesteve_b at hotmail.com>
> >This is a multi-part message in MIME format.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-- So far, so annoying
> >Is there anything that would get in the way of me being able to =
> >reference an object attribute, from within a list.
> >I have:
> Where do you have it? This is not an actual verbatim example of something
> > # one class here
> > class BackupSet:
> ^--- this is different from your constructor call below at
> > fileGroupList =3D 
> > =20
> ># another class here
> > class FileGroup:
> > sourceDir =3D ''
> > destinDir =3D ''
> > def __init__(self):
> > self.sourceDir =3D 'c:\folder'
> > self.destinDir =3D 'd:\folder' =20
> >fileGroup =3D FileGroup()
> >backupSet =3D BackUpSet()
> ^-----  So I know you didn't do this.
> ># when i try to reference an attribute here, I just get 'none'
> Maybe you have some old code that reads
> self.sourceDir = 'none'
> in class FileGroup. Who can tell?
> >print bkset.fileGroupList.sourceDir or
> ^^^^^-- what the heck is that?
> >print "%s" % bkset.fileGroupList.sourceDir
> > =20
> >Content-Type: text/html;
> Two things:
> 1. Don't post HTML
> 2. Do post verbatim copy/pasted examples from the window where you
> actually tried what you are talking about. It's not that much more
> I'm hungry. I don't know why I'm putting off food even a minute to do this
> Bengt Richter
More information about the Python-list