Question about idioms for clearing a list
- From: Steven Watanabe <swatanabe@xxxxxxxxx>
- Date: Tue, 31 Jan 2006 11:57:03 -0500
I know that the standard idioms for clearing a list are:
(1) mylist[:] = [] (2) del mylist[:]
I guess I'm not in the "slicing frame of mind", as someone put it, but can someone explain what the difference is between these and:
(3) mylist = []
Why are (1) and (2) preferred? I think the first two are changing the list in-place, but why is that better? Isn't the end result the same?
Thanks in advance. -- Steven. .
- Follow-Ups:
- Re: Question about idioms for clearing a list
- From: Xavier Morel
- Re: Question about idioms for clearing a list
- From: Diez B. Roggisch
- Re: Question about idioms for clearing a list
- Prev by Date: Re: templates
- Next by Date: Re: determinant
- Previous by thread: Re: Mail Delivery (failure info@hermanosescudero.com)
- Next by thread: Re: Question about idioms for clearing a list
- Index(es):