Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Python FOR LOOPS

Name: Anonymous 2008-04-23 15:44

What the fuck is with Python's for loops.

What's the difference between:

for i in list[0]:

for i in list[0:]:

for i in list[:0]:

Name: Anonymous 2008-04-23 16:40

>>4
The First one wIll probably raise a TypeError, depending on whether or nOt the first element of "list" is iterable.
The seCond one will iterate through every element of list.
The third one will skip the body of the loop since list[:0] is empty.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List