I need to verify if a list is a subset of another – a boolean return is all I seek.

Is testing equality on the smaller list after an intersection the fastest way to do this? Performance is of utmost importance given the number of datasets that need to be compared.

Adding further facts based on discussions:

  1. Will either of the lists be the same for many tests? It does as one of them is a static lookup table.

  2. Does it need to be a list? It does not – the static lookup table can be anything that performs best. The dynamic one is a dict from which we extract the keys to perform a static lookup on.

What would be the optimal solution given the scenario?

14 Answers
14

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *