TypeError when subclassing 'list'

Gerard Flanagan grflanagan at yahoo.co.uk
Sun Feb 26 17:36:48 EST 2006


Steve Juranich wrote:
> Gerard Flanagan wrote:
>
> > Hello all
> >
> > Could anyone shed any light on the following Exception? The code which
> > caused it is below.  Uncommenting the 'super' call in 'XmlNode' gives
> > the same error. If I make XmlNode a subclass of 'object' rather than
> > 'list' then the code will run.
> ...
> > Code:
> >
> > from elementtree.SimpleXMLWriter import XMLWriter
> >
> > class XmlNode(list):
> >     tag = None
> >     attrib = None
> >     value = None
> >     def __init__(self, tag, **attrib):
> >         #super(list, self).__init__()
> >         self.tag = tag
> >         self.attrib = attrib
>
> I haven't put a lot of study into what you've done, but right off the bat,
> your use of "super" is incorrect.  It should look like:
>
>   super(XmlNode, self).__init__()
>
> Not sure if that will fix your problem, though.
>
> --
> Steve Juranich
> Tucson, AZ
> USA

Thanks Steve, but no - same error.

Gerard




More information about the Python-list mailing list