If a sort would be purely by ASCII value then you would have to treat the list elements as strings ...
# convert all list items to type string ...
mixed_list = [11, 'Dick', 12, 'Mary', 7, 'Zoe', 9, 700, 777, 'Paul', 13456789]
str_list = [str(x) for x in mixed_list]
# now it's a pure ASCII sort ...
print sorted(str_list)
"""
output -->
['11', '12', '13456789', '7', '700', '777', '9', 'Dick', 'Mary', 'Paul', 'Zoe']
"""
I think that was what Sneekula originally though might have happened.
I leaned on mawe's idea and created a generic function to extract the min and max values of a given type from a mixed list ...
def minmax4(lst, typ):
"""return min/max of mixed list lst for items of type typ"""
temp = [x for x in lst if isinstance(x, typ)]
return min(temp), max(temp)
# minmax4() test ...
mixed_list = [11, 'Dick', 12, 'Mary', 7, 'Zoe', 9, 700, 777, 'Paul', 13456789]
print mixed_list
print "The min and max of the integers are:"
mn, mx = minmax4(mixed_list, int)
print "minimum = %s maximum = %s" % (mn, mx)
print "The min and max of the strings are:"
mn, mx = minmax4(mixed_list, str)
print "minimum = %s maximum = %s" % (mn, mx)
"""
minmax4() test output -->
[11, 'Dick', 12, 'Mary', 7, 'Zoe', 9, 700, 777, 'Paul', 13456789]
The min and max of the integers are:
minimum = 7 maximum = 13456789
The min and max of the strings are:
minimum = Dick maximum = Zoe
"""