[Tutor] Best method for filtering lists in lists...

Chris Hengge pyro9219 at gmail.com
Wed Dec 20 00:34:48 CET 2006


If it adds to the fun, does it make a difference if I tell you that this
will be looking through
[0][0] - approx [0][6544]

On 12/16/06, Alan Gauld <alan.gauld at btinternet.com> wrote:
>
>
> "Roel Schroeven" <rschroev_nospam_ml at fastmail.fm> wrote
>
> >> In that case put the inner lists in a Set. That will eliminate
> >> duplicates.
> >
> > That won't work: list objects are unhashable so you can't put them
> > in a
> > set. You'll have to convert them to tuples first.
>
> Hmm, I took that a self evident but I guess maybe it wasn't...
>
> As for Luke's point about the speed of conversion, I'm not
> sure how that would stack up. I have a gut feel that it might
> be faster than trying to compare the lists element by
> element, that sounds like an algebraic expansion with list
> size to me, a hashed set sounds like it should be faster.
> But as with all such things, if speed matters: measure
> and profile it.
>
> Alan G.
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061219/5fc3247e/attachment.html 


More information about the Tutor mailing list