why no "do : until"?

David Morley morley at Borokay.ai.sri.com
Mon Jan 8 15:15:01 EST 2001


Tim Peters writes:
>   My own years-old suggestion for a "for" enhancement is the "indexing"
>   proposal, an optional clause on "for":
>
>       for i indexing a:
>       for i indexing x in a:

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):
    ...


David




More information about the Python-list mailing list