list.clear() missing?!?
Mel Wilson
mwilson-to at sympatico.ca
Thu Apr 13 08:19:44 EDT 2006
Steven D'Aprano wrote:
> Convenience and obviousness are important for APIs -- that's why lists
> have pop, extend and remove methods. The only difference I can see between
> a hypothetical clear and these is that clear can be replaced with a
> one-liner, while the others need at least two, e.g. for extend:
>
> for item in seq:
> L.append(item)
Both extend and append have one-line slice equivalents,
except that the equivalents have to keep referring to
the length of the list.. (have to keep finding the
len function.)
Mel.
More information about the Python-list
mailing list