immutable count and index

Tim Peters tim.one at home.com
Sun Aug 12 19:11:55 EDT 2001


[Grant Griffin]
> Does anybody know why the "count" and "index" methods are available for
> mutable, but not immutable, sequences?
> ...
> I can't say that I use these two much, ...

Bingo.  Code bloat just to stop random questions about things people don't
actually want anyway isn't worth it <wink>.

If you really have to, you can use operator.countOf on tuples.

> To me, it looks like the thing to do would be to make the
> general more form used by strings available for all sequence types.

SourceForge is open for patches, but be warned that Guido has rejected
patches of this ilk:

http://sf.net/tracker/?group_id=5470&atid=305470&func=detail&aid=403693
#403693 tupleobject.c: implement tuple.index() and tuple.count()





More information about the Python-list mailing list