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

Chris Hengge pyro9219 at gmail.com
Sat Dec 16 02:28:20 CET 2006


Oops, sorry about not replying to the list. I must have hit the wrong
button.

I'm terming a redundant list just like I posted in the original message:
[[1,2,3], [4,5,6],[1,2,3]]

[0][0] and [0][2] are redundant, so I only want to keep one of them.

Thanks again Luke.

On 12/15/06, Luke Paireepinart <rabidpoobear at gmail.com> wrote:
>
> Chris Hengge wrote:
> > Yes, we went over that a bit ago, but I wasn't sure if there were any
> > different or more appropriate approaches to this when dealing with
> > multidimensional lists.
> >
> Well, it depends what you term a redundant list.
> Like, is
> [[1,2,3],[3,2,1]]
> a list with 1 unique elements or two?
>
> If it is 1, then just sort all the lists before you check for redundancy.
>
> I don't think there are any algorithms that are specific to lists of
> lists, though there may be.
> -Luke
>
> P.S. please reply on-list :)
> >
> > On 12/15/06, *Luke Paireepinart* <rabidpoobear at gmail.com
> > <mailto:rabidpoobear at gmail.com>> wrote:
> >
> >     Chris Hengge wrote:
> >     > I've got a list of lists that looks like this
> >     >
> >     > [[1,2,3], [4,5,6],[1,2,3]]
> >     >
> >     > I'm looking for a good way to drop the redundant inner lists
> >     > (thousands of inner lists)
> >     >
> >     > Someone either have a good way to tackle this? or willing to
> >     point me
> >     > in the right direction?
> >     >
> >     > Thanks!
> >     >
> >     Didn't we give multiple solutions to a similar problem with lists
> >     with
> >     redundant elements a few weeks ago?
> >     Well, the solutions will be the same, regardless that the elements
> >     inside are lists themselves.
> >
> >     HTH,
> >     -Luke
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061215/afd6ecba/attachment.htm 


More information about the Tutor mailing list