more fun with PEP 276
James_Althoff at i2.com
James_Althoff at i2.com
Mon Dec 10 19:04:04 EST 2001
wtanksley wrote:
>> >>> for i in -5 // span // 5: # closed-closed
>> ... print i,
>> -5 -4 -3 -2 -1 0 1 2 3 4 5
>
>Intriguing. Odd. Perverted. Words would fail me, but doggone
>it, I find myself liking it.
Thanks, Billy. I was starting to wonder if
*anyone* was going come around to appreciating
its quirky wholesome-ness. <wink>
>The scary thing is that despite the ENORMOUS gap between the purpose
>of the / operator and your abuse of it (help! I'm being repressed!), I
>can still read this naturally: "span over length of myList".
>
>Minor niggle: how would users remember which operator represents which
>type of range ending? Do you have a proposed mnemonic?
/ and // weren't my first choice (< and <= were -- I'm still working
on that approach) but since they had the advantage of actually
*working* in this scheme, I just went with it. In my mind
/ seems "thinner" than // so it seems better matched to the
"thinner" interior interval whereas // seems better matched
to the *thicker* inclusive interval. Also, / seems better
matched to < (>) and // seems better matched to <= (>=).
>Actually, it was. I dunno if this should go in, but for its purposes
>I like it more than any of the other ideas, including my own.
Hey, thanks again.
Jim
More information about the Python-list
mailing list