On 28 October 2013 22:41, Guido van Rossum <guido@python.org> wrote:
I'm not sure I like new syntax. We'd still have to find a way to represent this with slice() and also with range().
It's a shame there isn't an indexing syntax where you can supply an iterator that produces the set of indexes you want and returns the subsequence - then we could experiment with alternative semantics in user code. So, for example (silly example, because I don't have the time right now to define an indexing function that matches any of the proposed solutions): >>> def PrimeSlice(): >>> yield 2 >>> yield 3 >>> yield 5 >>> yield 7 >>> 'abcdefgh'[[PrimeSlice()]] 'bceg' But of course, to make this user-definable needs new syntax in the first place :-( Paul