nest class name problem

Jeff Massung jmassung at magpiesystems.com
Mon Jun 19 15:09:31 EDT 2000


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???
>
>Thanks!
>
>--
>   __
>  /  )      /         Bob van der Poel
> /--<  ____/__        bvdpoel at uniserve.com
>/___/_(_) /_)         http://users.uniserve.com/~bvdpoel
>





More information about the Python-list mailing list