A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-April/034518.html below:

Adding item in front of a list

[Python-Dev] RE: Adding item in front of a listTim Peters tim.one@comcast.net
Wed, 09 Apr 2003 11:23:51 -0400
[Andrew Koenig, starting with l=[2, 3, 4]]
> ...
> I would have thought that after l.insert(-1, 1), l would be
> [2, 3, 1, 4], but it doesn't work that way.

Alas, list.insert() existed before sequence indices were generalized to give
a "count from the right end" meaning to negative index values.  When the
generalization happened, it appears that list.insert() was just overlooked.

I'd like to change this.  If I did, how loudly would people scream?

Guido says he also wishes list.insert() had been defined with the arguments
in the opposite order, so that list.insert(object) could have a natural
default index argument of 0.  I'd like to change that too, but it's clearly
too late for that one.




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4