list.clear() missing?!?

Ville Vainio vivainio at gmail.com
Fri Apr 14 16:51:32 EDT 2006


Duncan Booth wrote:

> Looking in the 'obvious' place in the Tutorial, section 5.1 'More on
> Lists' I found in the immediately following section 5.2 'The del
> statement':

I read the tutorial 6 years ago, and don't read it regularly. What's in
the tutorial is not really important, what can be easily looked up in
library reference or interctive prompt is.

There is a bit of "elitism" regarding the defense of del lst[:]. Many
python programmers are "casual" programmers (was it Tim Berners-Lee
that explained how great python is for casual users?) who know the
language but don't remember the way everything is done. Of course
someone that uses python 8 hours a day instantly recall lst[:], but a
casual one will more probably launch an ipython prompt and do:

[ipython]|1> l = []
[ipython]|2> l.
l.__add__          l.__getslice__     l.__ne__           l.append
l.__class__        l.__gt__           l.__new__          l.count
l.__contains__     l.__hash__         l.__reduce__       l.extend
l.__delattr__      l.__iadd__         l.__reduce_ex__    l.index
l.__delitem__      l.__imul__         l.__repr__         l.insert
l.__delslice__     l.__init__         l.__reversed__     l.pop
l.__doc__          l.__iter__         l.__rmul__         l.remove
l.__eq__           l.__le__           l.__setattr__      l.reverse
l.__ge__           l.__len__          l.__setitem__      l.sort
l.__getattribute__ l.__lt__           l.__setslice__
l.__getitem__      l.__mul__          l.__str__
[ipython]|2> # wtf?




More information about the Python-list mailing list