On Tue, Apr 05, 2022 at 04:02:24AM +1000, Chris Angelico wrote: > Is it really that much of a problem? Tell me: How often do you REALLY > expect to have collisions within an application, but in different > modules? YAGNI.
You have no idea how many different definitions there are for "mile", do you? :-) And I don't just mean historical miles, before standardisation. I mean even in current use, in English speaking countries. (And its not just miles that this problem affects.) Sure, we can demand that every application that needs to deal with US survey miles and imperial miles and international miles give them all distinct names. That's one solution, but not the only solution. But even if you do that, having one interpreter-wide database that any random library can write to is asking for trouble. If this becomes widespread, expecting libraries to "just don't overwrite existing units" is not good enough. Wait until you import some library which is not quite so accurate in its definitions as yours, and it tramples all over your system-wide database with its own (slightly different) definitions. How would you like your unit conversions to differ according to the order in which you import your libraries? "If I import cheddar first, then camembert, my lander safely lands on Mars, but if I import camembert first, then cheddar, it crashes into the planet at 215 miles per hour." Awesome. Its 2022, and you're arguing in favour of a single system-wide database where any random module can monkey-patch the definitions used by all other modules. Ouch. This is exactly analogous to the situation Python would have if there were no per-module globals, just the system-wide builtins, and every library stored top-level variables and functions in that namespace. *shudders* Look, I know that in Python, any module *might* sneak into my globals and modify them. But in practice, they don't, and that would be considered malware if they did it without very good reason and very obvious documentation. But to have a situation where *by design* all modules trample over each other's defined units, that's a suboptimal design. (I'm being polite there.) -- 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/MGBRJBKTNZ3AZS6CFDSMR6A3Y7LKY66N/ Code of Conduct: http://python.org/psf/codeofconduct/