Pop a list from beginning ? and memory saving...

François Pinard pinard at iro.umontreal.ca
Tue Jun 4 08:39:29 EDT 2002


[Shagshag13]

>  def reset(self):
>   del self._v
>   self._v = []

Just for the record, one could also write, in one line:

    self._v[:] = []

Probably unneeded in this case, but it is useful when one wants to keep
extra references to the list, and empty it nevertheless.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard





More information about the Python-list mailing list