On Tue, Sep 29, 2020 at 7:27 PM David Mertz <me...@gnosis.cx> wrote: > On Tue, Sep 29, 2020 at 12:09 PM Sebastian Kreft <skr...@gmail.com> wrote: > >> On Tue, Sep 29, 2020 at 6:56 PM David Mertz <me...@gnosis.cx> wrote: >> >>> I still think it would improve the PEP significantly if it added one >>> case of mixed positional/keyword indexing. Lots of suggestions have >>> floated by, and I don't care which one is used, but something to >>> demonstrate that within the PEP. >>> >> I agree, that use case should ideally be one that could have get, set and >> delete semantics. As most of the examples provided seem to only be meant >> for accessing the data. >> > > Both the units and source examples I gave would be very natural with set > and del semantics; enough that I just assumed those were understood. > Probably units moreso. > > internally_inches[4:6, 8:10, unit="meters"] = [[4, 2], [1, 3]] # Stores > [[157.48, ...], [..., ...]] in block >
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? When I originally read these examples, I thought the unit modifier would change the block location. It feels weird to me to have the unit disassociated from the actual value being stored. If I understood correctly what's going on, what would the difference between del internally_inches[4:6, 8:10, unit="meters"] and del internally_inches[4:6, 8:10, unit="inches"] > internally_cm[4:6, 8:10, unit="metres"] = [[4, 2], [1, 3]] # apparently > allow two spellings > > del internally_inches[1, unit="furlong"] # Delete one row, unit ignored > > -- > The dead increasingly dominate and strangle both the living and the > not-yet born. Vampiric capital and undead corporate persons abuse > the lives and control the thoughts of homo faber. Ideas, once born, > become abortifacients against new conceptions. > -- Sebastian Kreft
_______________________________________________ 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/OEXEE5H2OO5QSP3VQWZANVZFILR2RLKT/ Code of Conduct: http://python.org/psf/codeofconduct/