Understanding Python help() 's ... syntax, and the pop function for dictionaries

Viewed 27

The ... next to various python "help" method/function descriptions don't seem to be defined anywhere. What does function(...) mean, in the context of the python help output description?

Specifically, how should the documentation for python's pop function be interpreted?

Details

Given that the pop requires an input, it is a little confusing that help({}) doesn't show this in the functions input description (...). Interpreting the ... as "ditto" doesn't work - for example, "items" cannot take any inputs.

To be clear, this is the functions input definition from help.

pop(...)

The full output of the help({}) function, for get...pop is below. What do the ...'s mean, and, why is there no input defined, for the pop function?

     |  get(self, key, default=None, /)
     |      Return the value for key if key is in the dictionary, else default.
     |  
     |  items(...)
     |      D.items() -> a set-like object providing a view on D's items
     |  
     |  keys(...)
     |      D.keys() -> a set-like object providing a view on D's keys
     |  
     |  pop(...)
     |      D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
     |      If key is not found, d is returned if given, otherwise KeyError is raised

1 Answers
languages = ['Python', 'Java', 'C++', 'Ruby', 'C']
# here is a list
languages.pop(2)
# this will call the pop function for
# languages list and the it removes the element
# at the specified position.
# so after you take a look at languages
languages

Output: ['Python', 'Java', 'Ruby', 'C']

So as for your question. "pop" is a function so its usage is like any other function

thelist.pop(the-element-you-want-to-be-removed)

Related