On Thu, Aug 20, 2020 at 5:16 PM Steven D'Aprano <st...@pearwood.info> wrote:
> > If xarray supports keyword arguments, this would assign to the > > corresponding values. If it didn't, it would create a new element of the > > Dataset containing "y[a=2, b=3]". But "y" would continue working as it > > would, only with different values than expected. > > Thanks Todd, that's an excellent example of how an unexpected change > could lead to code doing the wrong thing instead of a nice, easy to > diagnose exception. > well, that isn't currently supported syntax anyway, so xarray won't break. But if we did add support for this, then xarray might use it, then it's a question of what it means -- I can't see how it would be ambiguous or break anything. though maybe I"m missing something .... And what I'm missing might be this: Jonatha's proposal is designed to make it easy for: [x=4, y=5] to make a little immutable mapping that can be used as a dict key. essentially shorthand for what you now have to do with: [CustomImmutableMapping(x=4, y=5)] But the problem with that is that if a class wants to use keyword indexing in a different way, then it would require extra effort to do so. -CHB -- Christopher Barker, PhD Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
_______________________________________________ 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/D6XB7FZ4LBEZ6UM2KXX4WOMWBLNRDBWW/ Code of Conduct: http://python.org/psf/codeofconduct/