[Python-ideas] Tail Call Optimization -- natural? intuitive?
Chris Angelico
rosuav at gmail.com
Mon Jan 20 15:50:23 CET 2014
On Tue, Jan 21, 2014 at 1:29 AM, spir <denis.spir at gmail.com> wrote:
> I also think there may be 2 kinds of notations for slices and such, one
> beeing [i,j] and the other maybe (i,n) where n is the number of items,
> rather than [i,k[ where k is the "post-last" or "past-the-end" index.
This is why REXX has the "DO... FOR" loop syntax. You can code a loop thus:
do i=1 to 5 /* 1, 2, 3, 4, 5 */
do i=1 to 5 by 2 /* 1, 3, 5 */
do i=1 by 2 for 6 /* 1, 3, 5, 7, 9, 11 */
The 'for N' criterion specifies the number of iterations to do,
regardless of the stop position. (REXX doesn't have slice notation, so
loops are the nearest equivalent.) It would be quite reasonable to
create a slice-like object in Python, but I'm not sure how to put all
of this functionality into syntax that's tight enough to be useful -
nobody wants to write foo[slice(1,None,2,count=5)] !
ChrisA
More information about the Python-ideas
mailing list