and [True,True] --> [True, True]?????

Paul Rubin http
Fri Apr 24 06:22:50 EDT 2009


Steven D'Aprano <steve at 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.



More information about the Python-list mailing list