more fun with PEP 276

Tony J Ibbs (Tibs) tony at lsl.co.uk
Wed Dec 12 12:02:42 EST 2001


The attributions have gotten tangled, but trying to reconstruct them, I
*think* someone called Billy (being quoted by wtanksley) may have
written:
> >>Minor niggle: how would users remember which operator
> >>represents which type of range ending?  Do you have a
> >>proposed mnemonic?

to which phil hunt responded:
> how about:
>
>    for i in -5 to 5:
>
> or
>
>    for i in -5 to 5 step 2:

Nah - that still doesn't resolve the "open or closed" end problem.

For American English speakers, I suspect that::

    for i in -5 through 5:

and::

    for i in -5 to 5:

may work (did I get that right?), but for British English speakers those
wouldn't work terribly well (even despite the gradual merging of
languages), since that distinctive use of "through" is not common. Maybe
the only sensible solution would be something like::

    for i in -5 uptobutnotincluding 5:

and::

    for i in -5 uptoandnotforgetting 5:

On the other hand, maybe the problem with finding a "spelling" for the
issue that actually works for more than a handful of people at a time is
why this issue doesn't get addressed?

    (mind you, *I* thought the ``for -5 < i <= 3:``
    proposal (sorry if I got it wrong) was meant as
    a neat piece of humour when I first read it, so
    who am I to comment?)

Tibs

--
Tony J Ibbs (Tibs)      http://www.tibsnjoan.co.uk/
I hope that's my tongue in my cheek and not my foot in my mouth...
My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.)





More information about the Python-list mailing list