On Tue, Sep 29, 2020, 2:41 PM Sebastian Kreft > You mean that internally_inches means the stored values are in inches, and > that by specifying a unit, you will scale up all the passed values? > > So that, internally_inches[4:6, 8:10, unit="meters"] = [[4, 2], [1, 3]] > would save in the (4:6, 8:10) block the value [[157.48, 78.7402], [39.3701, > 118.11]]? Is that right? >
Yes, that's exactly the hypothetical library/class I imagined. A keyword changing an "aspect" or "interpretation" of the data rather than the the memory location where bits are stored. The reason I'd want this is because, e.g. several HDF5 files I work with together might have different native units. Rather than globally convert all 10 billion numbers on first read, and convert them back before writing, only those values specifically utilized/modified would need conversion. del internally_inches[4:6, 8:10, unit="meters"] and > del internally_inches[4:6, 8:10, unit="inches"] > Again, this is hypothetical. But my way of thinking is that for this code, unit is ignored. But it shows consistency with the same unit being used everywhere else in the same program.
_______________________________________________ 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/WKGT4F7TWAY6MXP5DP75EEKBFCLXSMDA/ Code of Conduct: http://python.org/psf/codeofconduct/