Archive for March, 2011

Fast Way to Filter Large Python Lists

Let’s say you have a list of Python objects.

x = [["1","a"], ["2", "a"], ["3","b"], ["4","c"]]

And you have a second list of Python objects.

y = ["a", "b"]

Now let’s say you want to filter x so that it only contains objects for which the second value corresponds to the values in y. So in this case you [...] Read more »