Question about idioms for clearing a list

Terry Reedy tjreedy at udel.edu
Wed Feb 8 13:30:08 EST 2006


<bonono at gmail.com> wrote in message 
news:1139355802.990667.11690 at g14g2000cwa.googlegroups.com...
> I am confused. Could you explain this ? I was under the impression said
> above(mapping don't support slicing), until after I read the language
> reference. I don't think it is slicing as in the list slicing sense but
> it does use the term "extend slicing".
>
> http://www.python.org/doc/2.4.2/ref/slicings.html

I believe that extended slicing was introduced for multidimensional slicing 
of multidimensional arrays in Numerical Python.  Apparently, since such 
arrays are not indexed sequentially, they are considered as mappings.  The 
paragraph on extended slicing is much clearer if one knows how they are 
used in one of the numerical Python packages.

In the mathematical sense, a sequence can be considered to be a mapping of 
counts to whatever.  In some languages, sequences have been implemented 
literally as a mapping by 'associative arrays', the equivalent of Python's 
dict.  And dicts are sometimes used in Python to implement sparse arrays.

A set is not a mapping unless its members are all ordered pairs, as in a 
dict.

Terry Jan Reedy






More information about the Python-list mailing list