[Python-ideas] PEP pre-draft: Support for indexing with keyword arguments

Stefano Borini stefano.borini at ferrara.linux.it
Wed Jul 2 23:29:53 CEST 2014


On Thu, Jul 03, 2014 at 06:12:30AM +1000, Tim Delaney wrote:
> One option I don't see is to have a[b=1, c=2] be translated to
> a.__getitem__((slice('b', 1, None), slice['c', 2, None)) automatically.

it would be weird, since it's not technically a slice, but it would work.
I personally think that piggybacking on the slice would appear hackish.
One could eventually think to have a keyword() object similar to slice(), 
but then it's basically a single item dictionary (Strategy 1) with a fancy
name.




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

-----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