[Python-ideas] Have list/deque grow a copy() method

Georg Brandl g.brandl at gmx.net
Tue May 15 22:54:41 CEST 2007


Josiah Carlson schrieb:
> Georg Brandl <g.brandl at gmx.net> wrote:
>> Josiah Carlson schrieb:
>> > "Ian D. Bollinger" <ian.bollinger at gmail.com> wrote:
>> >> It would be nice if containers had a more consistent interface. The
>> >> standard idiom for copying a list has been L[:], but this isn't
>> > 
>> > The standard way of copying a list (or producing a list from an
>> > arbitrary sequence) is list(L).
>> 
>> The first part is news to me. Who defined that standard?
> 
> No one needs to define a standard for it to be the standard.  How would
> you propose, generally, to convert some arbitrary sequence into a list?

No, I meant the "copying a list" part. Getting a list from an iterable is
easiest with list(), of course.

Georg




More information about the Python-ideas mailing list