what does 'for _ in range()' mean?

Jon Perez jbperez808 at wahoo.com
Wed Jul 28 08:20:04 CEST 2004

I saw this code snippet:

for _ in range(20):
     newsock, client_addr = sock.accept()
     print "Client connected:", client_addr
     data[newsock] = ""

why use _ for this example?  Is there any
optimization to be had using it?

I know that in the interpreter _ means the
last value calculated, but what does _ mean
inside source code?

More information about the Python-list mailing list