Accessing 'mangled' class attrbutes

Gerard Flanagan grflanagan at
Wed Mar 1 16:29:15 CET 2006

Hello all

I would like to do the following:

  from elementtree.SimpleXMLWriter import XMLWriter

  class HtmlWriter(XMLWriter, object):
      def write_raw(self, text):
          super( HtmlWriter, self ).flush()
          super( HtmlWriter, self ).__write(text)

but because of the name-mangling caused by '__write' I get:

AttributeError: 'super' object has no attribute '_HtmlWriter__write'.

Is there any simple way round this situation in general?

(I just want to write out a HTML 'DOCTYPE' declaration)



More information about the Python-list mailing list