On Tue, 5 Apr 2022 at 05:44, Steven D'Aprano <st...@pearwood.info> wrote: > > Should 2.54 in / 1 cm evaluate to 2.54 in/cm or should > > it evaluate to 1? I'd much rather it evaluate to 1 > > There are only two reasonable ways to parse that, depending on > precedence of units and operators: > > * (2.54 inches) / (1 cm) = 6.4516 (dimensionless) > > * (2.54 inches / 1) * cm = 6.4516 cm**2 (or 1 square inch)
This second format is nonsense, and demonstrates why these need to be tagged numbers, NOT simple multiplications. > If there is a third way, I can't think of it. In any case, I don't see > how you can get 1. > > Maybe you mean 1 inch per 2.54 cm? This is why we need unit management > :-) > The question is really whether it's dimensionless or retains some record of the fact that it's length/length. The aspect ratio of a rectangle is really a length/length measure, even though it's technically dimensionless. An index of refraction is also dimensionless, but you can't talk about them as being equivalent. ChrisA _______________________________________________ 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/ONTUDZBP7VNQACVYZCQ3AU3ZZXA3GVMN/ Code of Conduct: http://python.org/psf/codeofconduct/