what does the super() function do?

--- On Fri, 4/24/09, Tyler Laing <trinio...@gmail.com> wrote:

From: Tyler Laing <trinio...@gmail.com>
Subject: Re: [pygame] Never seen this before
To: pygame-users@seul.org
Date: Friday, April 24, 2009, 7:58 PM

You get that kind of error when you use a recursive function, and it recurses 
down further than Python has room on the stack for. Typically, when you get 
this error, there's something wrong with your recursive function. What it 
appears to be doing is within your add function, its calling itself again. I 
think you might be wanting to call super(C, self).add(spr) where C is the class 
you created which has the add method. 


-Tyler

On Fri, Apr 24, 2009 at 5:27 PM, Yanom Mobis <ya...@rocketmail.com> wrote:


this code



level1 = [(0,0), (20, 0), (40, 0), (60, 0), (80, 0), (100,0), (120,0), (140,0), 
(160,0), (180,0), (200,0), (220,0), (240,0)] #positions of enemies
#yatta yatta
def setenemies_lvl1(): # put enemies on screen.

    pygame.display.set_caption("Loading Level") #tell player it's loading
    for item in level1: #loop throug coords in level file: lvl1
        enemies.add(random.choice(("enemyblue.png", "enemycyan.png", 
"enemygrey.png", "enemyyellow.png")), item, enemybullets)

    pygame.display.set_caption("PyStarFighter") #tell player it's done




is causing this problem:





  File "/usr/local/lib/python2.6/site-packages/pygame/sprite.py", line 325, in 
add

    self.add(spr)

 
 ####alot of the same message####

  File "/usr/local/lib/python2.6/site-packages/pygame/sprite.py", line 316, in 
add
    if isinstance(sprite, Sprite):
RuntimeError: maximum recursion depth exceeded while calling a Python object









      


-- 
Visit my blog at http://oddco.ca/zeroth/zblog




      

Reply via email to