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

Josiah Carlson jcarlson at uci.edu
Fri Jun 16 18:24:01 CEST 2006


"Noam Raphael" <noamraph at gmail.com> wrote:
> 
> 2006/6/16, Gareth McCaughan <gmccaughan at synaptics-uk.com>:
> > 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.
> >
> Thanks for your explanation of mathematical zero dimensional array! I
> just wanted to say that I really got to this just from trying to make
> a *computer program* as simple as possible - from what I know now,
> with empty subscript lists not allowed, my library will have more
> lines of code, will have more details of interface, and will require
> longer code to operate it. I'm not saying that not changing it will be
> terrible - I'm just saying that if changing something makes other
> things simpler AND goes along with mathematical intuition, it might be
> the right thing to do...

I'm not a mathematician, and I don't really work with arrays of any
dimensionality, so the need for 0-D subscripting via arr[] while being
cute, isn't compelling to my uses for Python.

Now, I appreciate the desire to reduce code length and complexity, but
from what I understand, the ultimate result of such a change to your
code would be to go from:
    arr[()]
to:
    arr[]

I don't see how this can reduce lines of code in implementation or use.
At most it is a two characters per use, and a change in documentation
(specifying how you subscript 0-D arrays).  If you can show an example
where actual code line count is reduced with this change, I can't
guarantee that I would get behind this proposal in a few months (if the
conversation starts up again), but it may make me feel less that your
proposal is essentially about aesthetics.

 - Josiah



More information about the Python-Dev mailing list