Name for Python's list index system

Thomas Wouters thomas at xs4all.net
Fri May 25 10:05:02 EDT 2001


On Fri, May 25, 2001 at 02:49:31PM +0100, Eddie and Babs wrote:

>     list[-1]    # Get last element
>     list[-2]    # Get 2nd to last element

> Do this feature have any "official" name in Python? If not, then I think it
> should. Perhaps "modulo" or "modular" indices? (Could be abbreviated to
> "mod")

I think 'negative indexing' is the name, and it suits it just fine. I've
seen people call it 'tail-indexing' and 'off-the-end indexing' and 'ministry
of silly indexing' as well, but they aren't as clear as 'negative indexing',
IMHO.

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list