more fun with PEP 276
William Tanksley Google
wtanksley at bigfoot.com
Mon Dec 10 16:05:37 EST 2001
More information about the Python-list mailing list
Mon Dec 10 16:05:37 EST 2001
- Previous message (by thread): more fun with PEP 276
- Next message (by thread): more fun with PEP 276
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
James_Althoff at i2.com wrote: > I think not. A compelling argument. <wink> > >>> 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. > >>> mylist = [0,1,2,3,4,5,6,7,8,9] > >>> for i in span / len(mylist): > ... print mylist[i], > 0 1 2 3 4 5 6 7 8 9 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". > The (claimed) advantages with this scheme include: > - no syntax changes required (!!!) > - handles all combinations of closed/open intervals Minor niggle: how would users remember which operator represents which type of range ending? Do you have a proposed mnemonic? > Now, that *was* fun, wasn't it. <wink> 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. > Jim -Billy
- Previous message (by thread): more fun with PEP 276
- Next message (by thread): more fun with PEP 276
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list