pop method question

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sun Mar 4 04:38:51 EST 2007


In <mailman.4638.1172976888.32031.python-list at python.org>, Nicholas
Parsons wrote:

> Just from my computer science background when I see pop(), I think of a
> stack data structure.

Then question your presumptions.  There are also many people thinking
`list` must be something with nodes and pointers when they see the
interface and usage of Python lists.

> But then again, there are other examples of ambiguity in the python
> language such as allowing operators like '+' to be overloaded.  Why not
> just have a "add()" method like Java?

Why does this remove ambiguity?  I even would expect different behaviour
from both.  I expect the ``+`` operator to return either an immutable or
entirely new object, while `add()` can be something on containers that
mutates the object.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list