New statement proposal for Python

Andrew Henshaw ahenshawatapowerdotcom
Fri Jun 15 23:10:43 EDT 2001


"David LeBlanc" <whisper at oz.nospamnet> wrote in message
news:9gbsdv$8ft$9 at 216.39.170.247...
...snip...
>
> As for the distinction between const(ant) and alias: Perhaps it's a
> matter of aesthetics, but somehow alias is more descriptive then const
> since it suggests the substition that's happening. Further, it's
> incorrect to call "alias true: not 0" a constant imho. To further
> belabour (with a tip of the hat to the english cousins) the point, it
> read so nicely to be able to say "if something is true" rather then "if
> something is not 0" (saves on typing too :-)).
>
...snip...

Speaking of aliasing... I fondly recall Occam's method of aliasing.  With
Occam, one can alias array slices so that working with message packets is
extremely easy.

For instance,  one can alias (e.g. "lastName") a slice [16:32] of an Occam
array of bytes "byteArray" with:

        lastName IS [byteArray FROM 16 FOR 16]:

and then use lastName as a new array name.  Then the first byte can be
referrenced with:

        lastName[0] := 'a'

This, of course, will change the 17th byte  in byteArray to 'a'.

Multidimensional arrays can be sliced and aliased, also -- very convenient,
efficient, and clear.

Aliasing could significantly improve the efficiency of a program running on
the Inmos Transputer, as its instruction set favored small index offsets,
and the aliasing lets the compiler know how to do that.


This would be nice on Python as well, particularly since naming a list slice
actually creates a copy (perhaps I've missed some capability here).







More information about the Python-list mailing list