def uniq(container):
try:<EOL><INDENT>return len(set(unbool(i) for i in container)) == len(container)<EOL><DEDENT>except TypeError:<EOL><INDENT>try:<EOL><INDENT>sort = sorted(unbool(i) for i in container)<EOL>sliced = itertools.islice(sort, <NUM_LIT:1>, None)<EOL>for i, j in zip(sort, sliced):<EOL><INDENT>if i == j:<EOL><INDENT>return False<EOL><DEDENT><DEDENT><DEDENT>except (NotImplementedError, TypeError):<EOL><INDENT>seen = []<EOL>for e in container:<EOL><INDENT>e = unbool(e)<EOL>if e in seen:<EOL><INDENT>return False<EOL><DEDENT>seen.append(e)<EOL><DEDENT><DEDENT><DEDENT>return True<EOL>
Check if all of a container's elements are unique.

Successively tries first to rely that the elements are hashable, then
falls back on them being sortable, and finally falls back on brute
force.