Python doesn't have an OrderedSet
; usually we fake it with an OrderedDict.
For example:
>>> from collections import OrderedDict
>>> s = "mathematics"
>>> alpha = "abcdefghiklmnopqrstuvwxyz"
>>> d = OrderedDict.fromkeys(s+alpha)
>>> d
OrderedDict([('m', None), ('a', None), ('t', None), ('h', None), ('e', None), ('i', None), ('c', None), ('s', None), ('b', None), ('d', None), ('f', None), ('g', None), ('k', None), ('l', None), ('n', None), ('o', None), ('p', None), ('q', None), ('r', None), ('u', None), ('v', None), ('w', None), ('x', None), ('y', None), ('z', None)])
>>> ''.join(d)
'matheicsbdfgklnopqruvwxyz'
This doesn't quite work as well as an OrderedSet
would, but is often close enough for government work.