Mercurial > hg > numerics
view numerics/convert.py @ 27:f865bc916593
stub for type inference
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Tue, 07 Oct 2014 21:04:36 -0700 |
parents | 7761aa18e885 |
children | a655306ee78d |
line wrap: on
line source
#!/usr/bin/env python """ convert between types """ import sys from .read import CSVParser __all__ = ['cast', 'float_or_orig'] def cast(to_type, *values): retval = [] for value in values: try: retval.append(to_type(value)) except ValueError: retval.append(value) return retval def float_or_orig(*values): return cast(float, *values) def main(args=sys.argv[1:]): """CLI""" if __name__ == '__main__': main()