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

Stefano Borini stefano.borini at ferrara.linux.it
Thu Jul 3 19:00:36 CEST 2014


On Thu, Jul 03, 2014 at 09:10:18AM +1000, Tim Delaney wrote:
> I really do think that a[b=c, d=e] should just be syntax sugar for a['b':c,
> 'd':e]. It's simple to explain, and gives the greatest backwards
> compatibility

This is indeed a point, as the initialization for a dictionary looks very, very similar,
however, it would definitely collide with the slice object. At the very least, it would be
confusing.

> In particular, libraries that already abused slices in this
> way will just continue to work with the new syntax.

Are there any actual examples in the wild of this behavior?



More information about the Python-ideas mailing list