Steve Juranich wrote:
> Gerard Flanagan wrote:
>
> > I tried that Steve but it didn't work, and i don't think I can do what
> > I want in any case. There is no method '__write' in the base class, it
> > is only declared as an instance attribute in the constructor, like so:
> >
> > def __init__
Gerard Flanagan wrote:
> I tried that Steve but it didn't work, and i don't think I can do what
> I want in any case. There is no method '__write' in the base class, it
> is only declared as an instance attribute in the constructor, like so:
>
> def __init__(self, file, encoding="us-ascii"):
[EMAIL PROTECTED] wrote:
> >>Is there any simple way round this situation in general?
>
> It might be safer to use composition instead of inheritance in this
> case. Assuming that XMLWriter has a write method to write what you
> want, you could hold a reference to an XMLWriter within your class and
Steve Juranich wrote:
> Gerard Flanagan wrote:
>
> > 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
>>Is there any simple way round this situation in general?
It might be safer to use composition instead of inheritance in this
case. Assuming that XMLWriter has a write method to write what you
want, you could hold a reference to an XMLWriter within your class and
pass along write command like:
w
Gerard Flanagan wrote:
> 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)
>
>
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