Grouping consecutive numbers into ranges in Python 3.2; third version (accepts page numbers as an unsorted set) def range_find(pageset):

    pagerangelist=[]

    for page in list(pageset):

        if page in pageset and page-1 in pageset:pagerangelist[-1].append(page)
        elif page in pageset and not (page-1 in pageset):pagerangelist.append([page])

    pagerangestringlist=[]

    for pagerange in pagerangelist:

        if len(pagerange)==1:pagerangestringlist.append(str(pagerange[0]))
        else: pagerangestringlist.append(str(pagerange[0])+'-'+str(pagerange[-1]))      

    return ','.join(pagerangestringlist)
def range_find(pageset):

    pagerangelist=[]

    for page in list(pageset):


There is no point in listifying the set just to iterate over it. I think you meant for page in sorted(pageset) to get access to the page in sorted order.

        if page in pageset and page-1 in pageset:pagerangelist[-1].append(page)
        elif page in pageset and not (page-1 in pageset):pagerangelist.append([page])


You still make it hard to read by putting those on the same line. 

    pagerangestringlist=[]


If you've got multiple words I suggest under scores. I also suggest dropping types like list/set from your names. I'd call this page_range_strings.

    for pagerange in pagerangelist:

        if len(pagerange)==1:pagerangestringlist.append(str(pagerange[0]))
        else: pagerangestringlist.append(str(pagerange[0])+'-'+str(pagerange[-1]))      


I'm going to recommend using string formating. It'll be easier to read then concatenating strings.

    return ','.join(pagerangestringlist)