count in 'for ... in ...'

Daniel Dittmar daniel.dittmar at sap.com
Tue Nov 6 11:09:42 EST 2001


I'm generally using something like:

class IndexLoop:
    def __init__ (self, list):
        self.list = list

    def __getitem__ (self, index):
        return index, self.list [index]

use as in

for index, entry in IndexLoop (list):
    ...

Daniel







More information about the Python-list mailing list