A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2006-June/065776.html below:

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

[Python-Dev] Pre-PEP: Allow Empty Subscript List Without ParenthesesGreg Ewing greg.ewing at canterbury.ac.nz
Sat Jun 10 01:48:22 CEST 2006
Noam Raphael wrote:

> This PEP suggests to allow the use of an empty subscript list, for
> example ``x[]``, which is currently a syntax error. It is suggested
> that in such a case, an empty tuple will be passed as an argument to
> the __getitem__ and __setitem__ methods. This is consistent with the
> current behaviour of passing a tuple with n elements to those methods
> when a subscript list of length n is used, if it includes a comma.

It's not, really -- unless other places where a tuple
can appear were changed likewise, e.g.

   x =

would have to assign an empty tuple to x, etc.

> But you may also have several
> zero-dimensional arrays, that is, single values - for example, the
> income tax rate.

But *why* do these need to be 0-dimensional arrays rather
than just scalars? I'm having trouble seeing any use
for such a distinction.

I'm particularly unconvinced by the spreadsheet argument.
In that context, I'd say that everything is a 2-D array,
and a single cell is a 1x1 2-D array, not a 0-D array.

--
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4