Steven D'Aprano <st...@remove-this-cybersource.com.au> writes: > len() works on dicts and sets, and they're not sequences.
Of course dicts and sets are sequences. But there are also sequences on which len doesn't work. You could use: sum(1 for x in seq) Of course iterating through seq may have undesired side effects. -- http://mail.python.org/mailman/listinfo/python-list