Re: list.clear() missing?!?
- From: Steven Bethard <steven.bethard@xxxxxxxxx>
- Date: Wed, 12 Apr 2006 09:35:27 -0600
Steven D'Aprano wrote:
On Tue, 11 Apr 2006 14:49:04 -0700, Ville Vainio wrote:[snip more reasons to add list.clear()]
John Salerno wrote:
Thanks guys, your explanations are really helpful. I think what had meInterestingly, if it was just a "clear" method nobody would be confused.
confused at first was my understanding of what L[:] does on either side
of the assignment operator. On the left, it just chooses those elements
and edits them in place; on the right, it makes a copy of that list,
right? (Which I guess is still more or less *doing* the same thing, just
for different purposes)
Even more importantly, you could say help(list.clear) and learn something
useful, instead of trying help(del) and getting a syntax error.
I think these are all good reasons for adding a clear method, but being that it has been so hotly contended in the past, I don't think it will get added without a PEP. Anyone out there willing to take out the best examples from this thread and turn it into a PEP?
STeVe
.
- Follow-Ups:
- Re: list.clear() missing?!?
- From: Raymond Hettinger
- Re: list.clear() missing?!?
- From: John Salerno
- Re: list.clear() missing?!?
- References:
- list.clear() missing?!?
- From: Ville Vainio
- Re: list.clear() missing?!?
- From: John Salerno
- Re: list.clear() missing?!?
- From: Fredrik Lundh
- Re: list.clear() missing?!?
- From: John Salerno
- Re: list.clear() missing?!?
- From: Ville Vainio
- Re: list.clear() missing?!?
- From: Steven D'Aprano
- list.clear() missing?!?
- Prev by Date: Re: converting lists to strings to lists
- Next by Date: Re: just one more question about the python challenge
- Previous by thread: Re: list.clear() missing?!?
- Next by thread: Re: list.clear() missing?!?
- Index(es):
Relevant Pages
|
|