why no "do : until"?
Alex Martelli
aleaxit at yahoo.com
Mon Jan 8 17:32:42 EST 2001
"David Morley" <morley at Borokay.ai.sri.com> wrote in message
news:fvy9wlztq2.fsf at Borokay.AI.SRI.COM...
[snip]
> What would be wrong with:
>
> class Indexing:
> def __init__(self, thing):
> self.thing = thing
> def __getitem__(self, index):
> return (index, self.thing[index])
>
> for (i,x) in Indexing(a):
Just the redundant parentheses --
for i, x in Indexing(a):
reads fractionally more smoothly (and similarly,
the parentheses are not needed on the return
from __getitem__). Pretty cool idea though!-)
Alex
More information about the Python-list
mailing list