On Mon, Apr 04, 2022 at 08:27:45AM -0000, Brian McCall wrote: > Why don't we allow different libraries to use different, incompatible > implementations of integers, floating points, and bool?
We do. numpy supports 32-bit and 64-bit ints and possibly others, gmpy supports mpz integers. I don't know about floats, but there's nothing stopping anyone from developing a library for 32-bit floats, or minifloats, or posits, or whatever. > Standard units > are just as immutable as any of these data types. Immutability vs mutability is just one design decision out of many that we would have to make. Regardless of which way we go, we still have to deal with the facts that: * There are an unlimited number of derived (non-SI) and compound units that people will want to use. * Many of those can have conflicting names, e.g. "mile" can refer to any of Roman mile, international mile, nautical mile, U.S. survey mile, Italian mile, Chinese mile, imperial mile, English *miles* (note plural), and many more. * To say nothing of having to deal with adjustments to the definitions, e.g. a kilometre in 1920 is not the same as a kilometre in 2020, and applications that care about high precision may care about the difference. Having a single interpreter-wide namespace for units will cause many name collisions. I expect that units should be scoped like variables are, with some variant of the LEGB (Local, Enclosing, Global, Builtin) scoping rules in place. At the very least, we should have two namespaces, per module and per interpreter. That will allow modules to register their own units without stomping all over those over other modules. -- Steve _______________________________________________ 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/7NGHPB557AS7MC2GKONYPMMZ355RRCRF/ Code of Conduct: http://python.org/psf/codeofconduct/