nest class name problem

Bob van der Poel bvdpoel at uniserve.com
Mon Jun 19 16:10:07 EDT 2000


Thanks... I think I tried somethings like your suggestion. However,
neither

	print Goption.__name
or
	print Goption.self.name

work. Both give errors. 

Jeff Massung wrote:
> 
> I'm still learning, but lemme take a crack and let others correct me ;)
> 
> __name isn't a member of MyDialog class, so you can't use self with it,
> because then it looks for MyDialog.__name, which doesn't exist. But perhaps
> you can use Goption.__name instead of self.__name?
> 
> I don't know what the long term effects of this would be for maintaining,
> etc. but I think it should work.
> 
> Jeff
> 
> Bob van der Poel wrote in message <394E67CE.9E29D310 at uniserve.com>...
> >
> >I'm having a problem accessing objects created in a nested class. What I
> >have (extracted) is:
> >
> >class Goption:
> >        __name = ""
> >
> >        def __init__(self, name):
> >                self.__default = default
> >                .. more ..
> >
> >        def change(self):
> >                class MyDialog(tkSimpleDialog.Dialog):
> >
> >                        def body(self, master):
> >                                print self.__name
> >                                ... more ...
> >
> >
> >The print 'self.__name' doesn't work. How do I access the variable
> >__name???
> >


-- 
   __
  /  )      /         Bob van der Poel
 /--<  ____/__        bvdpoel at uniserve.com
/___/_(_) /_)         http://users.uniserve.com/~bvdpoel



More information about the Python-list mailing list