Allowing zero-dimensional subscripts

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


Hello,

Terry Reedy wrote:
> So I do not see any point or usefulness in saying that a tuple subcript is
> not what it is.

I know that a tuple is *constructed*. The question is, is this,
conceptually, the feature that allows you to ommit the parentheses of a
tuple in some cases. If we see this as the same feature, it's
reasonable that "nothing" won't be seen as an empty tuple, just like "a
= " doesn't mean "a = ()".

However, if we see this as a different feature, which allows
multidimensional subscript by constructing a tuple behind the scenes,
constructing an empty tuple for x[] seems very reasonable to me. Since
in some cases you can't have the parentheses at all, I think that x[]
makes sense.

Noam




More information about the Python-list mailing list