>>2
Holy fuck I lol'd harder than I lol at }; every time.
Name:
Anonymous2008-04-23 15:52
>>1
The first one runs the for loop once, with i set to list[0], the second one runs the loop for each element of list, and the third one does nothing.
To see why, enter list[0], list[0:] and list[:0] in the interpreter.
Name:
Anonymous2008-04-23 15:54
for i in list[0]: every item in list[0]
for i in list[0:]: every item in list from list[0] to the end
for i in list[:0]: every item in list from the start to list[0]
Name:
Anonymous2008-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.
>>17
And the funny thing is, he got the same quality of answers in both boards, the only difference being that /prog/ added some chucklesome nonsense to the thread also.
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy