history of del ListItem[x]

Martin von Loewis loewis at informatik.hu-berlin.de
Mon Sep 17 05:24:58 EDT 2001


"Maan Hamze" <mmhamze at pleiades.net> writes:

> This is out of curiousity only:
> Say we have a list List
> To delete an item x from a list we use:
> del List[x]
> 
> One expects from Python:
> List.Delete[x]

Note that you can also use

List[x:x+1] = []

In fact, performing del List[x] eventually ends up as a slice
assignment in the interpreter.

> Any history or reason for the former use?

I guess it was inherited from ABC, see the DELETE statement in

http://www.cwi.nl/~steven/abc/qr.html

Regards,
Martin



More information about the Python-list mailing list