Python Language Design, the Idiocy of Pop Method

By Xah Lee. Date: . Last updated: .

The Idiocy of Python Pop

here's another python idiocy, of its pop method for removing a item in a list.

normally, pop() is a traditional computer science jargon for removing the top item of a stack data structure, as in, a stack of books.

but in python, it added a parameter to pop(i) for removing item at index i. Almost like an after thought.

xstack = [1, 2, 3, 4, 5, 6]
print(xstack.pop())  # 6
print(xstack.pop(0)) # 1

This is quite idiotic, because, the word pop is only for the stack structure. You don't really pop a book in the middle of stack.

if you want to remove an item by index, python already has

del list[i]

Again, python is quite inconsistent all over. Some operation are methods, some are functions, some are operators, and some are simply “syntax”.

This inconsistency for pop does not happen in perl, ruby, JavaScript, emacs lisp, scheme lisp, clojure, Wolfram language, PowerShell, java, go.

in other languages, if they have a function to remove and return item, it is not named pop.

As far as i know, uniquely a python idiocy.