On the previous thread, Rickey wrote: > Python SHOULD be that language we do this with. It is awesome in every other > way. But if it isn't DEAD SIMPLE to use units in python, it won't happen.
I agree, being dead simple to use is of critical importance. Not only that, but there are a number of modules and packages that already exist that would need an update to support units natively. NumPy and SciPy of course, but also Matplotlib, Pandas. Even argparse would need to be updated (which is one I have to use a lot, fortunately not with negative values): ``` >>> import re, argparse >>> meters = lambda x : float(re.sub(r'm','',x)) >>> parser = argparse.ArgumentParser() >>> parser.add_argument("-l", "--length", dest='length', type=meters) _StoreAction(option_strings=['-l', '--length'], dest='length', nargs=None, const=None, default=None, type=<function <lambda> at 0x7fafb8f95c10>, choices=None, help=None, metavar=None) >>> parser.parse_args("-l -12".split()) Namespace(length=-12.0) >>> parser.parse_args("-l -12m".split()) usage: [-h] [-l LENGTH] : error: argument -l/--length: expected one argument ``` _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/FCN7AANTQXEC674IVDFJLV7CJ6IZ2VSA/ Code of Conduct: http://python.org/psf/codeofconduct/