def numberIndexStringFromNumbers(indexes):
	"""
	Turns sequence 1,2,3,4,7,8,9,10,14,19,21,22,23,27,30,31,32
	into "1-4, 7-10, 14, 19, 21-23, 27, 30-32"
	"""
	indexes = sorted( indexes )
	outputString = ""
	previousNumber = -100
	for i, thisNumber in enumerate(indexes):
		if not outputString:
			outputString += str(thisNumber)
		else:
			if previousNumber == thisNumber-1:
				if outputString[-1] != "-":
					outputString += "-"
				elif i == len(indexes)-1:
					outputString += "%i" % thisNumber
			else:
				if outputString[-1] == "-":
					outputString += "%i" % previousNumber
				outputString += ", %i" % thisNumber
		previousNumber = thisNumber
	return outputString