Problems with subclassing

Alex Martelli aleaxit at yahoo.com
Sun Sep 12 18:56:33 EDT 2004


Alexander Stante <alex_stante at yahoo.de> wrote:

> I have the following problem. I want to subclass from the pygame class
> Surface, but I can't get it working:
> 
> class sprite(Surface):
> def __init__(self, image_array, palette):
> "some code here"
> 
> when I want to create a instance with:
> 
> gfx.sprite(arrayi, palette)
> 
> 
> I get the following error message:
> TypeError: argument 1 must be sequence of length 2, not 100
> 
> It seems that the constructor of Surface is not overrided by the one in
> sprite, but why?

It's possible (I'm just guessing) that the problem comes with respect to
__new__ rather than __init__ ...?


Alex



More information about the Python-list mailing list