<p>Imagine you got an entity in the Google App Engine datastore, storing links for anonymous users. 
You would like to perform the following SQL query, which is not supported:</p>

<pre><code>SELECT DISTINCT user_hash FROM links
</code></pre>

<p>Instead you could use:</p>

<pre><code>user = db.GqlQuery("SELECT user_hash FROM links")
</code></pre>

<p>How to use Python <strong>most efficiently</strong> to filter the result, so it returns a DISTINCT result set?
How to count the DISTINCT result set?</p>

One option would be to put the results into a set object:
http://www.python.org/doc/2.6/library/sets.html#sets.Set
The resulting set will consist only of the distinct values passed into it.
Failing that, building up a new list containing only the unique objects would work. Something like:
```
```
unique_results = []
for obj in user:
    if obj not in unique_results:
        unique_results.append(obj)
```
```
That
```
for
```
loop can be condensed into a list comprehension as well.