> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Scott > > I understand all that. What I don't understand is why all the > documentation > I see says, "When removing a specific element from a list using pop() it > must be in this format: list.pop([i]). > At first I took that to mean that list.pop(i) would return some type of > error, but it doesn't. > I can't find any documentation saying that this rule that I keep reading > about (again list.pop([i]) ) is the only format to use when removing a > specific element because......with the explaination to follow.
I believe that the [i] notation is to indicate that it has to be a valid index to your list. If i isn't a valid index, you get an IndexError. >>> spam=['this', 'is', 'a', 'list'] >>> spam.pop(1) 'is' >>> spam.pop(4) Traceback (most recent call last): File "<pyshell#10>", line 1, in -toplevel- spam.pop(4) IndexError: pop index out of range --- -Bill Hamilton -- http://mail.python.org/mailman/listinfo/python-list