Traceback (most recent call last):
   File "C:/Python24/foofoofoo.py", line 26, in -toplevel-
     s2 = Sub2()
   File "C:/Python24/foofoofoo.py", line 22, in __init__
     super(Sub2, self).__init__()
   File "C:/Python24/foofoofoo.py", line 10, in __init__
     if type(self) == __TwoUnderBase:  # What to write here
NameError: global name '_TwoUnderBase__TwoUnderBase' is not defined

Within a class, __ prefixes mangle the name to include the class name as
part of the name.  However, it appears that within a class statement,
the __ prefix is not mangled.  This is good for you because otherwise
the inheritance would not work.  However, it appears to make it
impossible to directly reference the class name from within the class.
You may want to rethink the idea of using __ prefixes in the class name.
Normally __ is used to "privatize" attributes within a class.

-- 
Lloyd Kvam
Venix Corp

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to