Python search: how to do it efficiently
<p>I have one class have 2 variable members:</p>

<pre><code>class A:
    fullname = ""
    email = ""
</code></pre>

<p>There is a list of A stored in memory, now I need to search against fullname or email, the search needs to support fuzzy search(assemble the SQL 'like' clause), eg) search "abc", for "dabcd" it should match(if it can show the exact match first it will be better).</p>

<p>I think I should build index on 'fullname' and 'email'?</p>

<p>Please suggest, thanks!</p>

<p>EDIT: If I only need exact match, will two dictionaries with 'fullname' and 'email' to be the key is the best choice? I see some articles says the fetching is O(1).</p>

<p>2nd EDIT: The 'best' I defined is for the search speed(best speed). As I think in python a reference will only be stored as the pointer into the dictionaries, so the space allocation should not be a problem. I have thousands of record.</p>
