[Python-Dev] accumulator display syntax

Alex Martelli aleaxit at yahoo.com
Fri Oct 17 18:09:09 EDT 2003


On Friday 17 October 2003 11:50 pm, Guido van Rossum wrote:
> > Yes.  But don't mind me, I'm still sad that we have range and xrange
> > when iter(a:b) and list(a:b:c) would be SUCH good replacements for
> > them if slicing-notation was accepted elsewhere than in indexing,
>
> This has been proposed more than once (I think the last time by Paul
> Dubois, who wanted x:y:z to be a general expression), and has a
> certain elegance, but is probably too terse.

Perhaps mandatory parentheses around it (as sole argument in a
function call, say) might make it un-terse enough for acceptance...?

The frequence of counted loops IS such that replacing

for x in range(9): ...

with

for x in (0:9): ...

WOULD pay for itself soon in reduced wear and tear on keyboards...;-)

[Using iter(0:9) instead would be only "conceptually neat", no typing
advantage on range -- conceded].


Alex




More information about the Python-Dev mailing list