Issue with sys.exit() in pygame
===

I am learning to use pygame, and when I use sys.exit() I run into a problem. Here is the code:


    import pygame, sys,os
    from pygame.locals import * 
 
    pygame.init() 
 
    window = pygame.display.set_mode((468, 60)) 
    pygame.display.set_caption('Game') 
    screen = pygame.display.get_surface() 

    file_name = os.path.join("data","image.bmp")

    surface = pygame.image.load(file_name)

    screen.blit(surface, (0,0)) 
    pygame.display.flip() 
 
    def input(events): 
       for event in events: 
          if event.type == QUIT: 
             sys.exit(0) 
          else: 
             print event 
 
    while True: 
       input(pygame.event.get()) 


It's really just the code from the pygame tutorial. The problem occurs when I actually try to exit, regardless of what event I try to use to sys.exit(). 

    Traceback (most recent call last):
      File "C:/Python27/Lib/site-packages/pygame/examples/test.py", line 25, in <module>
        input(pygame.event.get())
      File "C:/Python27/Lib/site-packages/pygame/examples/test.py", line 20, in input
        sys.exit(0)
    SystemExit: 0

... And then the program doesn't exit. What am I doing wrong here? Because I did notice that this code was for an antiquated version of Python.