Suggested feature: slice syntax within tuples (or even more generally)?

Duncan Booth duncan.booth at invalid.invalid
Thu Feb 14 07:25:23 EST 2013


stephenwlin at gmail.com wrote:

> Would it be feasible to modify the Python grammar to allow ':' to
> generate slice objects everywhere rather than just indexers and
> top-level tuples of indexers? 
> 
Would this be a dict with a slice as key or value, or a set with a slice 
with a step?:

    {1:2:3}

You can't just allow ':' to generate slice objects everwhere without 
introducing ambiguity, so your proposal would have to be to allow slice 
objects in wider but still restricted contexts.

-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list