def decistmt(s):
 result = []
 g = generate_tokens(StringIO(s).readline)
 for (toknum, tokval, _, _, _) in g:
  if ((toknum == NUMBER) and ('.' in tokval)):
   result.extend([(NAME, 'Decimal'), (OP, '('), (STRING, repr(tokval)), (OP, ')')])
  else:
   result.append((toknum, tokval))
 return untokenize(result)

def decistmt ( s ) : result = [ ] g = generate_tokens ( StringIO ( s ) . readline ) for ( toknum , tokval , _ , _ , _ ) in g : if ( ( toknum == NUMBER ) and ( '.' in tokval ) ) : result . extend ( [ ( NAME , 'Decimal' ) , ( OP , '(' ) , ( STRING , repr ( tokval ) ) , ( OP , ')' ) ] ) else : result . append ( ( toknum , tokval ) ) return untokenize ( result )
substitute decimals for floats in a string of statements .