Re: list IndexError
From: Grant Edwards (grante_at_visi.com)
Date: 12/23/04
- Next message: Jp Calderone: "Re: Lambda going out of fashion"
- Previous message: Steven Bethard: "Re: Keyword arguments - strange behaviour?"
- In reply to: Steven Bethard: "Re: list IndexError"
- Next in thread: Steven Bethard: "Re: list IndexError"
- Reply: Steven Bethard: "Re: list IndexError"
- Reply: Steven Bethard: "copying builtin types (WAS: list IndexError)"
- Reply: Jeff Shannon: "Re: list IndexError"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 23 Dec 2004 16:28:50 GMT
On 2004-12-23, Steven Bethard <steven.bethard@gmail.com> wrote:
>> Ah, my mistake, I missed the [:] after the source argument
>> that was taking a copy... which brings up the question, how
>> many other people would miss it?
>
> Too many. This is why I greatly prefer
>
> list(lst)
To me, that's just as non-obvious. I would have guessed that
calling list() on a list was a noop. I would be wrong.
Surprised, but wrong.
> to
>
> lst[:]
>
> It's also clearer to me. Do I really want a "slice" of the
> list? No, I want a list copy of the list...
Wouldn't the clearest way to get a copy would be to do
something like:
copy(lst) # I still think copy.copy() is a bit verbose...
or
lst.copy() # doesn't exist, but I think it should :)
--
Grant Edwards grante Yow! I had pancake makeup
at for brunch!
visi.com
- Next message: Jp Calderone: "Re: Lambda going out of fashion"
- Previous message: Steven Bethard: "Re: Keyword arguments - strange behaviour?"
- In reply to: Steven Bethard: "Re: list IndexError"
- Next in thread: Steven Bethard: "Re: list IndexError"
- Reply: Steven Bethard: "Re: list IndexError"
- Reply: Steven Bethard: "copying builtin types (WAS: list IndexError)"
- Reply: Jeff Shannon: "Re: list IndexError"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]