Package diffpy :: Package pdfgui :: Module utils
[hide private]
[frames] | no frames]

Module utils

source code

Small shared routines:
numericStringSort   -- sort list of strings according to numeric value
safeCPickleDumps    -- same as cPickleDumps, but safe for NaN and Inf



Functions [hide private]
 
numericStringSort(lst)
Sort list of strings inplace according to general numeric value.
source code
 
safeCPickleDumps(obj)
Get cPickle representation of an object possibly containing NaN or Inf.
source code
Variables [hide private]
  __id__ = '$Id: utils.py 2980 2009-04-02 00:14:33Z juhas $'
Function Details [hide private]

numericStringSort(lst)

source code 
Sort list of strings inplace according to general numeric value.
Each string gets split to string and integer segments to create keys
for comparison.  Signs, decimal points and exponents are ignored.

lst  -- sorted list of strings

No return value to highlight inplace sorting.

safeCPickleDumps(obj)

source code 
Get cPickle representation of an object possibly containing NaN or Inf.
By default it uses cPickle.HIGHEST_PROTOCOL, but falls back to ASCII
protocol 0 if there is SystemError frexp() exception.

obj -- object to be pickled

Return cPickle string.