On 31 May 2016 at 15:24, Steven D'Aprano firstname.lastname@example.org wrote:
On Tue, May 31, 2016 at 02:12:05PM +0000, Joseph Martinot-Lagarde wrote:
It could work with indexing, like:
key -> my_dict
key = my_dict[key]
That would have to be
key = my_dict['key']
With the possible exception of the typing module, I don't see when that would be useful.
It's reminiscent of the recent "dictionary unpacking" discussion.
But it's doable without special-casing  anyway:
key -> my_dict.get
[I still prefer "call the RHS with the name of the LHS as the argument" over "inject the name of the LHS as the first argument of the call present on the RHS", btw - mostly because it has fewer restrictions and special cases to define]