multiple inheritance from list and other class

lars van gemerden lars at rational-it.com
Sun Jan 8 05:48:47 EST 2012


On Jan 8, 7:42 am, Steven D'Aprano <steve
+comp.lang.pyt... at pearwood.info> wrote:
> On Sat, 07 Jan 2012 17:16:22 -0800, lars van gemerden wrote:
> > Hello,
>
> > I have an error message i do not understand:
>
> > My code is in essence:
>
> The code you give works fine. It does not show the error you say it does.
> Please test your code before posting and ensure it actually fails the way
> you expect.
>
> It is perfectly fine to use multiple inheritance in the way you show.
> Here is an even simpler example:
>
> py> class Spam(object):
> ...     pass
> ...
> py> class Ham(list, Spam):
> ...     pass
> ...
> py>
> py> h = Ham([1, 2, 3])
> py>
>
> And no exception is raised.
>
> --
> Steven

Sorry for wasting you time, I found the error (had "def" instead of
"class" before B in the example), sorry about not testing, shouldn't
post at 2:00 AM.

Thanks all the same, Lars



More information about the Python-list mailing list