pop method question
Nicholas Parsons
parsons.nicholas1 at gmail.com
Sun Mar 4 07:42:22 EST 2007
On Mar 4, 2007, at 4:38 AM, Marc 'BlackJack' Rintsch wrote:
> 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.
Good point :).
>
>> 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.
This is true. As long as the language (be it Java, Python, X) itself
remains consistent over time, then this should be fine.
>
> Ciao,
> Marc 'BlackJack' Rintsch
> --
> http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list