Am I the only one who would love these extentions? - Python 3.0 proposals (long)

Alex Martelli aleax at aleax.it
Mon Nov 10 14:40:14 EST 2003


Peter Otten wrote:
   ...
>> -- Ellipsis -- it looks like an alien in the language.
> 
> What the heck is this? The Nutshell index does not have it, and I couldn't
> make any sense of the section in the language reference.

Ooops, sorry -- I guess I shouldn't have skipped it in the Nutshell.

Ellipsis is the singleton object that represents ... (three dots) used
in an indexing.  Check this out:

>>> class showindex(object):
...   def __getitem__(self, index): return index
...
>>> si = showindex()
>>> si[1, ..., 7]
(1, Ellipsis, 7)
>>>

see?  in this case, the index is a 3-tuple, and Ellipsis is its middle
item.  As far as I know, the only USE of this notation is in package
Numeric (p. 307-308 in the Nutshell), to indicate that some indices or
slices apply to the rightmost axes of a multi-dimensional array.

Few Pythonistas outside of the ranks of numeric-array mavens may have
any interest in multi-dimensional arrays and the like.  However, such
numeric-array mavens are an important part of the Python community (thanks
to such wonderful add-ons as Numeric, its future successor numarray, and
the many splendid packages built on top), so you can judge for yourself
what the chance may be that Guido would want to take away from under them
the "..." syntax that is so useful and habitual for them.


Alex





More information about the Python-list mailing list