import re
stop_list = map(lambda s: '\\b' + str(s) + '\\b', list(range(1000, 2000)))
stopstring = '|'.join(stop_list)
stopword_pattern = re.compile(stopstring)
Python regex pattern max length in re.compile?