> 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