Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread Gerard Flanagan
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__

Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread Steve Juranich
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"):

Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread Gerard Flanagan
[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

Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread Gerard Flanagan
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

Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread [EMAIL PROTECTED]
>>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

Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread Steve Juranich
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) > >

Accessing 'mangled' class attrbutes

2006-03-01 Thread Gerard Flanagan
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