I just did something similar for a colleague. Here is the complete code snippet. Just like you suggest, I build two empty lists and append the unique values to them. Note, I'm using the new da.SearchCursor at 10.1.
import arcpy
def int_if_you_can(x):
return int(x) if x % 1.0 == 0 else x
#Reference layer and update to Unique Value renderer using layer file
mxd = arcpy.mapping.MapDocument("current")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
lyr100 = arcpy.mapping.ListLayers(mxd, "interval_100")[0]
lyrFile = arcpy.mapping.Layer(r"C:\Active\ArcPY\Users\SteveLynch\interval_100.lyr")
arcpy.mapping.UpdateLayer(df,lyr100,lyrFile)
#Apply source data to layer
sym = lyr100.symbology
sym.addAllValues()
#Generate unique list of lables
classList = []
labelList = []
with arcpy.da.SearchCursor(lyr100, ("mean_cont", "low_cont", "high_cont"), sql_clause=(None,"ORDER BY mean_cont")) as rows:
for row in rows:
lowCont = str(int_if_you_can(row[1]))
highCont = str(int_if_you_can(row[2]))
if not lowCont + " - " + highCont in labelList:
classValue = in_if_you_can(row[0])
classList.append(classValue)
label = lowCont + " - " + highCont
labelList.append(label)
#Update layer with new label classes
sym.classValues = classList
sym.classLabels = labelList
arcpy.RefreshActiveView()
Jeff