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

Gerrit Holl gerrit.holl at pobox.com
Thu Jul 8 16:41:10 EDT 1999


On Thu, Jul 08, 1999 at 09:09:44PM +0200, M.-A. Lemburg wrote:
> Date: 	Thu, 08 Jul 1999 21:09:44 +0200
> From: "M.-A. Lemburg" <mal at lemburg.com>
> To: Bob Alexander <bobalex at ix.netcom.com>
> Cc: python-list at python.org
> Subject: Re: Why are index() and count() only for mutable sequences?
> 
> 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.
> 

Is this an anwser??
He asked: "why"...

regards,
Gerrit.

-- 
The Dutch Linuxgames homepage:	http://linuxgames.nl.linux.org
Personal homepage:		http://www.nl.linux.org/~gerrit/

Discoverb is a python program (in several languages) which tests the words you
learned by asking it. Homepage: http://www.nl.linux.org/~gerrit/discoverb/
Oh my god! They killed init! You bastards!




More information about the Python-list mailing list