[Python-Dev] An ability to specify start and length of slices

Jeff Epler jepler at unpythonic.net
Fri Jun 4 15:52:36 EDT 2004


Some questions:

At the top, you mention the syntax
    object[start:>length:jump]
  but you never explain what that does.  Is it equivalent to
    object[start:start+length*jump:jump] # give length items
  or
    object[start:start+length:jump] # give length/jump items
  ?

What about negative strides?

Is there a way to ask for the length items just before stop, for
instance
    object[>length:start:jump]
?

About Tim's suggestion:

Pretending for a moment that it could fly, can we make sure this works
with dicts, and also create +, for tuples and lists?

I'd like
    { 1 +: 3 }
to create the dict {1:4}, and for
    1, 3 +, 5
to create the tuple (1, 3, 8)

One last comment -- While you'll have a hard sell with this new syntax
idea, having an implementation for it makes you stand above all the
other people peddling their bad syntax change on the mailing lists.

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-dev/attachments/20040604/868f4225/attachment.bin


More information about the Python-Dev mailing list