[Python-ideas] Accepting keyword arguments for __getitem__

Stefano Borini stefano.borini at ferrara.linux.it
Mon Jun 23 14:53:39 CEST 2014


On Mon, Jun 23, 2014 at 10:24:53PM +1000, Chris Angelico wrote:
> The obvious way to accept that would be to support keyword arguments,
> and then it begins looking very much like a call. Can you alter your
> notation very slightly to become LDA(Z=5) instead? 

We certainly can, but I was wondering if such extension would be useful in other contexts.
Also, with the function solution, you would lose the order of the entries. You can't distinguish
foo(z=3, r=4) from foo(r=4, z=3)

-- 
------------------------------------------------------------

-----BEGIN GEEK CODE BLOCK----- 
Version: 3.12         
GCS d- s+:--- a? C++++ UL++++ P+ L++++ E--- W- N+ o K- w---
O+ M- V- PS+ PE+ Y PGP++ t+++ 5 X- R* tv+ b DI-- D+
G e h++ r+ y*
------------------------------------------------------------



More information about the Python-ideas mailing list