slicing, mapping types, ellipsis etc.

Nick Coghlan ncoghlan at email.com
Tue Nov 30 06:18:26 EST 2004


Jerry Sievers wrote:
> Fellow Pythonists;
> 
> I am totally puzzled on the use of slicing on mapping types and

It's generally not supported (since slices are designed to work with the 
numerical indices of a sequence, not the arbitrary keys of a mapping).

The results of d.keys(), d.values() & d.items() can all be sliced like any other 
sequence, though.

> especially unsure on use of the Ellipsis... and slicing syntax that
> has two or more groups seperated by comma.

Others have explained these - one point that may not have been entirely clear is 
that none of the classes in the standard library make use of these (although the 
point may have been implied by the references to PyNumeric as the place to look 
for more exact documentation. Python's own documentation of the slice() builtins 
makes reference to Numeric!).

Cheers,
Nick.




More information about the Python-list mailing list