def get_rows_n_and_other(self, N, sortby='Size'):
	# Get N rows, the largest first
	# mix in an '<Other>' row at a sorted position
	# Size is either size if sortby = 'Size',
	#    or count if sortby = 'Count'.
	# Returns a NEW LIST (caller may modify/sort it)

	if sortby not in ('Size', 'Count'):
	    raise ValueError, "Argument 'sortby' must be 'Size' or 'Count'."

	# Rows are already sorted by Size, largest first.
	# If they want by Count, we need to resort them.

	rows = self.get_rows()

	if sortby == 'Count':
	    rows = list(rows)
	    rows.sort(lambda x, y: cmp(y.count, x.count))
	
	retrows = []
	cumulcount = 0
	cumulsize = 0
		    
	for (i, r) in enumerate(rows):
	    if i >= N:
		othercount = self.count - cumulcount
		othersize = self.size - cumulsize
		other = StatRow(othercount,
				othersize,
				'<Other>')
				
		if sortby == 'Size':
		    for (i, r) in enumerate(retrows):
			if r.size < othersize:
			    retrows[i:i] = [other]
			    break
		    else:
			retrows.append(other)
		elif sortby == 'Count':
		    for (i, r) in enumerate(retrows):
			if r.count <= othercount:
			    retrows[i:i] = [other]
			    break
		    else:
			retrows.append(other)
		else:
		    assert 0
		break

	    cumulcount += r.count
	    cumulsize += r.size
	    retrows.append(r)
	else:
	    assert cumulcount == self.count
	    assert cumulsize == self.size

	return retrows
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/guppy-0.1.10/guppy/heapy/Part.py/Stat.get_rows_n_and_other/operator `<` -> `<=`