[Python-Dev] Pre-PEP: Allow Empty Subscript List Without Parentheses

Gareth McCaughan gmccaughan at synaptics-uk.com
Fri Jun 16 13:15:41 CEST 2006

> But only if it makes sense. I still think there are some
> severe conceptual difficulties with 0D arrays. One is
> the question of how many items it contains. With 1 or
> more dimensions, you can talk about its size along any
> chosen dimension. But with 0 dimensions there's no size
> to measure. Who's to say a 0D array has a size of 1, then?
> Part of my brain keeps saying it should be 0 -- i.e.
> it contains nothing at all!

For what it's worth (probably little), I'm fairly sure that
if you were to ask the question of a bunch of mathematicians
you'd get absolute unanimity on a 0-D array containing exactly
one element, indexed by the (unique) empty sequence. You'd
probably also get absolute unanimous puzzlement as to why
anyone other than mathematicians should care.

I'd say there are "conceptual difficulties" in the sense
that the concept is difficult to get one's head around,
not in the sense that there's any real doubt what the
Right Answer is.

For anyone unconvinced, it may or may not be helpful to
meditate on the fact that <anything>**0 is 1, and that an
empty product is conventionally defined to be 1.

None of the above is intended to constitute argument for
or against Noam's proposed change to Python. Python isn't
primarily a language for mathematicians, and so much the
better for Python.

Gareth McCaughan (unashamed pure mathematician, at least
by training and temperament)

More information about the Python-Dev mailing list