On 26 August 2016 at 14:49, Ivan Levkivskyi <[email protected]> wrote:
> On 26 August 2016 at 13:01, Steven D'Aprano <[email protected]> wrote: > >> On Fri, Aug 26, 2016 at 07:35:36AM +0200, Pavol Lisy wrote: >> > On 8/25/16, Ken Kundert <[email protected]> wrote: >> > >> > [...] >> > >> > > Just allowing the units to be present, even it not >> > > >> > > retained, is a big advantage because it can bring a great deal of >> clarity to >> > > the >> > > meaning of the number. For example, even if the language does not >> flag an >> > > error >> > > when a user writes: >> > > >> > > vdiff = 1mV - 30uA >> > >> > It reminds me: "Metric mishap caused loss of NASA's Mars Climate >> > orbiter. It could be nice to have language support helping to avoid >> > something similar. >> > > [snip] > > >> Take v = s/t (velocity equals distance over time). If I write v = s >> because it is implicitly understood that the time t is "one": >> >> s = 100 miles >> v = s >> >> Should v be understood as 100 miles per hour or 100 miles per second or >> 100 miles per year? That sort of ambiguity doesn't come up in circuit >> design, but it is common elsewhere. >> > > If one writes this as > > from units import m, s, miles > > s = miles(100) > v: m/s = s > Sorry for a name collision in this example. It should read: dist = miles(100) vel: m/s = dist -- Ivan
_______________________________________________ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
