Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
pstats.TupleComp Class Reference

List of all members.

Public Member Functions

def __init__
def compare

Public Attributes


Detailed Description

This class provides a generic function for comparing any two tuples.
Each instance records a list of tuple-indices (from most significant
to least significant), and sort direction (ascending or decending) for
each tuple-index.  The compare functions can then be used as the function
argument to the system sort() function when a list of tuples need to be
sorted in the instances order.

Definition at line 435 of file

Constructor & Destructor Documentation

def pstats.TupleComp.__init__ (   self,

Definition at line 443 of file

00444     def __init__(self, comp_select_list):
00445         self.comp_select_list = comp_select_list

Here is the caller graph for this function:

Member Function Documentation

def (   self,

Definition at line 446 of file

00447     def compare (self, left, right):
00448         for index, direction in self.comp_select_list:
00449             l = left[index]
00450             r = right[index]
00451             if l < r:
00452                 return -direction
00453             if l > r:
00454                 return direction
00455         return 0
00458 #**************************************************************************
00459 # func_name is a triple (file:string, line:int, name:string)

Member Data Documentation

Definition at line 444 of file

The documentation for this class was generated from the following file: