On Thu, Aug 20, 2020 at 12:55 PM Jonathan Fine <jfine2...@gmail.com> wrote:

> In addition, I would like
>>     >>> d = dict()
>>     >>> d[x=1, y=2] = 5
>> to work. It works out-of-the-box for my scheme.
>>
>
1) it does? could you explain that, I can't see it.
2) so what? -- it would still only work with the next version of Python,
and the dict could be updated in that version
3) I don't think I want that to "just work" anyway -- in fact, I have no
idea what it means. I can guess that it essentially created something like
a namedtuple that is used as a key -- is that correct? in which case, I'm
not sure I would want that, as you'd need/want a way to make that same key
object outside of indexing, and then you might as well just make it.

as an example, you can now do:

In [2]: d[1,2] = 'this'

In [3]: t = (1,2)

In [4]: d[t]

Out[4]: 'this'

But I'm pretty sure I have never done that before just now, though I have
certainly used tuples as keys in dicts.

In any case, I'd suggest you keep the discussion of extending dict behavior
a bit separate from the more general extension to indexing -- it's fine as
an example, but this is not about adding functionality for dicts, and I
suspect that dicts are the least interesting use case to most of us.

-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/3KP4QK2B5YIZKH6VVZOBBCV2XCCAZR26/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to