On 30/08/20 7:45 pm, Guido van Rossum wrote:
Do we want to support d[**kwargs]? It can be done, alternatively we could just ask the user to write the __getitem__/__setitem__ call explicitly.
I thought we usually discouraged directly calling dunders unless there's no alternative, because there is often extra processing in between the language syntax and the corresponding dunder that would get skipped. It wouldn't make a difference in this case given the implementation you describe, but I think it's just tidier to be able to avoid the direct call. We don't have to decide now, though -- it can be added later.
I think we should say no to d[*args], because that will just become d[(*args)],
Which is also equivalent to d[args]. But if we have d[**kwds] without d[*args] I expect there will forever be people asking how to do d[*args]. So maybe allow it but just ignore the *. -- Greg _______________________________________________ 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/S46X5WUYD4HYVG7NE77ID5SEBQTF72BA/ Code of Conduct: http://python.org/psf/codeofconduct/