You will lose duplicates if you want. If this is actually a list of "votes", as your name says, you would have "lost" :)
why not just:
if x in set(request.session['vote_set'])
if you are worried.
Although I need to wonder if this will be slower than simple:
if x in request.session['vote_set']
And the order, as others have pointed out, will potentially (most likely) be lost.
source
share