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

Jon Perez jbperez808 at wahoo.com
Wed Jul 28 02:20:04 EDT 2004


I saw this code snippet:

sock.listen(20)
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