Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8065
| From | rusi <rustompmody@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Is there any advantage or disadvantage to using sets over list comps to ensure a list of unique entries? |
| Date | 2011-06-20 20:59 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <8f67e8a1-bb2d-4d20-af2c-dfdb93679301@35g2000prp.googlegroups.com> (permalink) |
| References | <5b73ae60-506f-45e4-a82c-e59571252d47@w4g2000yqm.googlegroups.com> |
On Jun 21, 12:43 am, deathweaselx86 <deathwea...@gmail.com> wrote: > Howdy guys, I am new. > > I've been converting lists to sets, then back to lists again to get > unique lists. Maybe you should consider whether its best to work with sets only and not use lists at all. This needs to be said because: 1. Most intros to python show lists (and tuples which is almost the same) and hardly mention sets 2. Until recent versions python did not have sets The basic question to ask yourself is: Is order/repetition significant? If not you want a set.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is there any advantage or disadvantage to using sets over list comps to ensure a list of unique entries? deathweaselx86 <deathweasel@gmail.com> - 2011-06-20 12:43 -0700
Re: Is there any advantage or disadvantage to using sets over list comps to ensure a list of unique entries? Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-20 13:59 -0600
Re: Is there any advantage or disadvantage to using sets over list comps to ensure a list of unique entries? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-21 01:10 +0000
Re: Is there any advantage or disadvantage to using sets over list comps to ensure a list of unique entries? Ethan Furman <ethan@stoneleaf.us> - 2011-06-20 20:29 -0700
Re: Is there any advantage or disadvantage to using sets over list comps to ensure a list of unique entries? rusi <rustompmody@gmail.com> - 2011-06-20 20:59 -0700
Re: Is there any advantage or disadvantage to using sets over list comps to ensure a list of unique entries? Raymond Hettinger <python@rcn.com> - 2011-06-25 01:05 -0700
csiph-web