Package kwkey v0.0.2 provides items-keys duality to support PEP 637

I'm pleased to announce v0.0.2 of my kwkeys package. https://pypi.org/project/kwkey/ The main new feature is items-key duality. Based on that, it emulates the semantics proposed by D'Aprano and van Rossum. It also emulates the semantics proposed by myself. What does this mean? Here, by duality I mean treating items[key] key[items] as roughly equivalent. This allows us to move the keyword arguments outside the square brackets. In other words, the following items[1, 2, a=3, b=4] = val X(1, 2, a=3, b=4)[items] = val are roughly equivalent. Here, X should implement the semantics one wishes to use for items[1, 2, a=3, b=4] =val and the other item access methods (ie setitem and delitem). I've already implemented three options for X. They are: * class A: The current semantics * class B: The semantics proposed by D'Aprano and van Rossum * class C: The semantics proposed by Fine (ie myself) and more can readily be provided. Experiments cost little. Here's something nice. You can with current Python implement a class that will work today via duality calls such as X(1, 2, a=3, b=4)[items] = val and after the implementation of PEP 637 the class will continue to work. In other words, with post PEP 637 Python this items[1, 2, a=3, b=4] =val will work, provided you choose the value of X that Python implements. For more information see https://www.python.org/dev/peps/pep-0637/ https://pypi.org/project/kwkey/ https://github.com/jfine2358/python-kwkey Guido: Apologies for calling you von Rossum in the README. I know you're Dutch. I've already fixed it in the source. Perhaps next time I'll use the safer GvR. -- Jonathan
participants (1)
-
Jonathan Fine