I will clarify my previous post, by making a stronger statement. Every Python object is an instance of a class.
I wrote: Let's proceed. We continue to use d = Dummy(). Given that
>>> key = d[1, 2, 3, a=4, b=5]
is allowed, what should we be able to say about the key. Clearly it should be an instance of a class, and there should be a way of creating such an instance without going via d. Let's call the class K (for key).
I'll now expand on this, as it's not clear to everyone that the key should be an instance of a class.
So far I know, every Python object that is accessible to the Python user is an instance of a class (or type). In fact, the type command tells us the object's type.
>>> [type(obj) for obj in (None, True, (), {}, [], type)]
[<class 'NoneType'>, <class 'bool'>, <class 'tuple'>, <class 'dict'>, <class 'list'>, <class 'type'>]
Using d = Dummy(), where d's __getitem__(self, k) simply returns k, we write using the proposed new syntax
>>> key = d[1, 2, 3, a=4, b=5]
and give this I suggest that
>>> key2 = K(1, 2, 3, a=4, b=5)
should produce a key2 that is equal to key. Here
>>> K = type(key)
should provide K.
I hope this helps clarify what I wrote. I also thank Alex Hall for providing helpful clarification, from a different point of view.
--
Jonathan