[Python-Dev] Pre-PEP: Allow Empty Subscript List Without Parentheses
Guido van Rossum
guido at python.org
Fri Jun 9 19:05:39 CEST 2006
More information about the Python-Dev mailing list
Fri Jun 9 19:05:39 CEST 2006
- Previous message: [Python-Dev] FYI: wsgiref is now checked in
- Next message: [Python-Dev] Pre-PEP: Allow Empty Subscript List Without Parentheses
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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/)
- Previous message: [Python-Dev] FYI: wsgiref is now checked in
- Next message: [Python-Dev] Pre-PEP: Allow Empty Subscript List Without Parentheses
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list