Why are index() and count() only for mutable sequences?

M.-A. Lemburg mal at lemburg.com
Thu Jul 8 15:09:44 EDT 1999


Bob Alexander wrote:
> 
> There is no modification of the sequence performed by these functions
> -- it seems as though they could be available for all sequences. It
> would certainly be useful for tuples as well as lists (strings, too,
> for that matter, even though we have the more general string.find()).

You could try count(), index(), forall() and exists() from mxTools:

	http://starship.skyport.net/~lemburg/mxTools.html

Albeit, they work with conditions (functions that return 1/0) to
implement the testing process.

Cheers,
-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                   176 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/





More information about the Python-list mailing list