Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news.astraweb.com!border5.newsrouter.astraweb.com!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: Converting a set into list References: <87iptdid68.fsf@benfinney.id.au> <871v00j2bh.fsf@benfinney.id.au> <34fc571c-f382-405d-94b1-0a673da5f46b@t16g2000vbi.googlegroups.com> X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney Date: Tue, 17 May 2011 10:33:16 +1000 Message-ID: <87mximf9o3.fsf@benfinney.id.au> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:KcLwXCN+zAkGTUyxqMn0udQvokk= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Lines: 24 Organization: Unlimited download news at news.astraweb.com NNTP-Posting-Host: df54362b.news.astraweb.com X-Trace: DXC=Zj1]1_E^2mG6;?e@]GfeBGL?0kYOcDh@JN7:H2`MmAUCNUD]k];EK]N]G;2>V^?kWCbEW9A[5UK?ENZ[SL`C\KgCQfdghBGD?e@ Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5542 TheSaint writes: > Thomas Rachel wrote: > > > Which loops do you mean here? > > list(set) has been proved to largely win against > list = [] > for item in set: > list.append(item) > or [list.append(item) for item in set] Remember that the criterion of speed is a matter of the implementation, and what's fast on one won't necessarily be fast on others. Which implementations did you try? Where I do agree is that ‘list(foo)’ wins over the other examples you show on the important criteria of concision and readability. -- \ “A thing moderately good is not so good as it ought to be. | `\ Moderation in temper is always a virtue; but moderation in | _o__) principle is always a vice.” —Thomas Paine | Ben Finney