pop() clarification

Jerry Hill malaclypse2 at gmail.com
Wed Apr 11 12:55:09 EDT 2007


On 4/11/07, Scott <s_broscious at comcast.net> wrote:
> I see says, "When removing a specific element from a list using pop() it
> must be in this format: list.pop([i]).

The tutorial (http://docs.python.org/tut/node7.html) says the following:

pop( [i] )
    Remove the item at the given position in the list, and return it.
If no index is specified, a.pop() removes and returns the last item in
the list. (The square brackets around the i in the method signature
denote that the parameter is optional, not that you should type square
brackets at that position. You will see this notation frequently in
the Python Library Reference.)

Does that answer your question?

-- 
Jerry



More information about the Python-list mailing list