Allowing zero-dimensional subscripts

spam.noam at gmail.com spam.noam at gmail.com
Fri Jun 9 09:00:01 EDT 2006


Hello,

Sybren Stuvel wrote:
> I think it's ugly to begin with. In math, one would write simply 'x'
> to denote an unsubscribed (ubsubscripted?) 'x'. And another point, why
> would one call __getitem__ without an item to call?

I think that in this case, mathematical notation is different from
python concepts.

If I create a zero-dimensional array, with the value 5, like this:
>>> a = array(5)

I refer to the array object as "a", and to the int it stores as "a[]".

For example, I can change the value it holds by writing
>>> a[] = 8
Writing "a = 8" would have a completely different meaning - create a
new name, a, pointing at a new int, 8.

Noam




More information about the Python-list mailing list