Terry Reedy wrote: > Guido has so far vetoed adding .__len__() to the iterator protocol because > a) it is not always possible and
Be warned that this is a veto after the fact: # (only) python 2.4 >>> len(iter(range(42))) 42 # python 2.5 >>> len(iter(range(42))) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: len() of unsized object > b) he want to keep the protocol as simple > as it is. You will be able to write considerably more complex generators in 2.5: http://docs.python.org/dev/whatsnew/pep-342.html Peter -- http://mail.python.org/mailman/listinfo/python-list