Is there a pygame constant that checks when no buttons are being pressed?

When using the KEYDOWN thing, if i have 2 buttons pressed, then i release one of those with the other still being held down, the charactor just stops instead of doing the right stuff based on the button that is still held down :S

This behavior is consistent with most other applications I believe. It may have something to do with the way input is handled by the Operating System.

I tried to make a function to figure this out but it never returns 0 :(

Heres the code:

def getNumKeysPressed():
    temp = 0
    for item in pygame.key.get_pressed():
        if item:
            temp += 1
    return temp

It should return 0 at some stage, because it refreshes everytime the function gets called ( temp = 0 ) which is everytime it goes around the loop.
Heres where it's called:

for event in pygame.event.get():
            val = getNumKeysPressed() ##Here
            if event.type == pygame.QUIT:
                pygame.quit()
                return
            if  event.type == pygame.KEYDOWN:
                if event.key == pygame.K_LEFT:
                    p.walk_left()
                elif event.key == pygame.K_RIGHT:
                    p.walk_right()
                elif event.key == pygame.K_UP:
                    p.walk_up()
                elif event.key == pygame.K_DOWN:
                    p.walk_down()
            if val == 0:
                p.reset()

All you help will and has been appreciated :)

Don't worry I fixed it, it turns out that when there is no buttons pressed, pygame.key.get_pressed() returns a list with one value in it, so my function returned a value of 1 :P

This question has already been answered. Start a new discussion instead.