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

Nick Maclaren nmm1 at cus.cam.ac.uk
Sun Jun 18 11:35:29 CEST 2006


Talin <talin at acm.org> wrote:
> 
> Ok, so in order to clear up the confusion here, I am going to take a 
> moment to try and explain Noam's proposal in clearer language.
> 
> Now, as to the specifics of Noam's problem: Apparently what he is trying 
> to do is what many other people have done, which is to use Python as a 
> base for some other high-level language, building on top of Python 
> syntax and using the various operator overloads to define the semantics 
> of the language.

No, that's too restrictive.  Back in the 1970s, Genstat (a statistical
language) and perhaps others introduced the concept of an array type
with an indefinite number of dimensions.  This is a requirement for
implementing such things as continengy tables, analysis of variance
etc., and was and is traditionally handled by some ghastly code.  It
always was easy to handle in LISP and, as far as this goes, Python is
a descendent of LISP rather than of Algol, CPL or Fortran.

Now, I thought of how conventional "3rd GL" languages (Algol 68,
Fortran, C etc.) could be extended to support those - it is very
simple, and is precisely what Noam is proposing.  An index becomes
a single-dimensional vector of integers, and all is hunky-dory.
When you look at it, you realise that you DO want to allow zero-length
index vectors, to avoid having to write separate code for the scalar
case.

So it is not just a matter of mapping another language, but that of
meeting a specific requirement, that is largely language-independent.


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email:  nmm1 at cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679


More information about the Python-Dev mailing list