def scourUnitlessLength(length, needsRendererWorkaround=False):
 if (not isinstance(length, Decimal)):
  length = getcontext().create_decimal(str(length))
 if (int(length) == length):
  length = getcontext().create_decimal(int(length))
 nonsci = unicode(length).lower().replace('e+', 'e')
 if (not needsRendererWorkaround):
  if ((len(nonsci) > 2) and (nonsci[:2] == '0.')):
   nonsci = nonsci[1:]
  elif ((len(nonsci) > 3) and (nonsci[:3] == '-0.')):
   nonsci = ('-' + nonsci[2:])
 if (len(nonsci) > 3):
  sci = unicode(length.normalize()).lower().replace('e+', 'e')
  if (len(sci) < len(nonsci)):
   return sci
  else:
   return nonsci
 else:
  return nonsci

def scourUnitlessLength ( length , needsRendererWorkaround = False ) : if ( not isinstance ( length , Decimal ) ) : length = getcontext ( ) . create_decimal ( str ( length ) ) if ( int ( length ) == length ) : length = getcontext ( ) . create_decimal ( int ( length ) ) nonsci = unicode ( length ) . lower ( ) . replace ( 'e+' , 'e' ) if ( not needsRendererWorkaround ) : if ( ( len ( nonsci ) > 2 ) and ( nonsci [ : 2 ] == '0.' ) ) : nonsci = nonsci [ 1 : ] elif ( ( len ( nonsci ) > 3 ) and ( nonsci [ : 3 ] == '-0.' ) ) : nonsci = ( '-' + nonsci [ 2 : ] ) if ( len ( nonsci ) > 3 ) : sci = unicode ( length . normalize ( ) ) . lower ( ) . replace ( 'e+' , 'e' ) if ( len ( sci ) < len ( nonsci ) ) : return sci else : return nonsci else : return nonsci
scours the numeric part of a length only .