Accessing 'mangled' class attrbutes

Gerard Flanagan grflanagan at yahoo.co.uk
Wed Mar 1 10:29:15 EST 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)

Thanks

Gerard




More information about the Python-list mailing list