A RetroSearch Logo

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

Search Query:

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

Allow Empty Subscript List Without Parentheses

[Python-Dev] Pre-PEP: Allow Empty Subscript List Without ParenthesesGuido van Rossum guido at python.org
Fri Jun 9 19:05:39 CEST 2006
On 6/9/06, Nicko van Someren <nicko at nicko.org> wrote:
> On 9 Jun 2006, at 17:44, Guido van Rossum wrote:
>
> > This is an elaborate joke, right?
> >
> > On 6/9/06, Noam Raphael <noamraph at gmail.com> wrote:
> ...
> >> It's simply this: Currently, the expression "x[]" is a syntax
> >> error. I
> >> suggest that it will be a valid syntax, and equivalent to "x[()]",
> >> just as "x[a, b]" is equivalent to "x[(a, b)]" right now.
> ...
> >> Motivation
> >> ==========
> >>
> >> This suggestion allows you to refer to zero-dimensional arrays
> >> elegantly.
>
> I don't think that this suggestion is any less reasonable the the
> very existence of zero-dimensional arrays in the first place,
> although in my personal opinion that's a fairly low bar.

The language doesn't have zero-dimensional arrays, although it doesn't
prevent users from defining them. but why would one want to index a
zero-dimensional array, since it has no dimensions? It should be
written as x, not x[].

The need for () is pretty clear and can be explained to beginners
(zero-length arrays are not that unusual).

The need for x[] is not clear to beginners, and accepting this as
legal syntax just moves certain typos from compile-time to run-time
detection.

The timing is such that there's no way this can be added to 2.5 --
beta 1 is about to be released. It's true that new features can be
added until that release -- but that's for features that have been
agreed upon for a long time and just haven't gotten implemented yet --
not for brand new proposals.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
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