On Thu, 14 Mar 2013, Steven D'Aprano wrote:
If you have some unknown, arbitrary iterable that doesn't support len(),
then you can use the sum() trick:

it = some_unknown_iterable()
sum(1 for x in it)

Yes, of course you are correct. This was my intention, but I chose an especially poorly contrived example. Thank you for the clarification.

--dk
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to