Re: accessing class variables of private classes

2005-01-16 Thread Peter Otten
Uwe Mayer wrote: > I need to access class variables of a class I'd like to make private: > > i.e. > class __Bar(object): > pass > > class __Foo(__Bar): > def __init__(self): > super(__Foo, self).__init__() > __Foo() > Name Error: global name '_Foo__Foo' is not defined > > Here I w

Re: accessing class variables of private classes

2005-01-16 Thread Mark McEahern
Uwe Mayer wrote: Hi, I need to access class variables of a class I'd like to make private: Use single underscores instead of double underscores--you won't have to workaround the name mangling. Besides, nothing's really private anyway. // m -- http://mail.python.org/mailman/listinfo/python-lis

accessing class variables of private classes

2005-01-16 Thread Uwe Mayer
Hi, I need to access class variables of a class I'd like to make private: i.e. class __Bar(object): pass class __Foo(__Bar): def __init__(self): super(__Foo, self).__init__() >>> __Foo() Name Error: global name '_Foo__Foo' is not defined Here I want to prevent the user of instanciating