How come tuples don't have an index method?
tjreedy at home.com
Fri Sep 7 20:45:52 CEST 2001
"Tim Peters" <tim.one at home.com> wrote in message
news:mailman.999883580.3508.python-list at python.org...
> [Michael Abbott and Terry Reedy, wonder why tuples don't have
> and count() methods]
> > ...
> > so I see no good reason not to give tuples methods also.
> > Seems like a PEP project.
> It's already been implemented and rejected:
> In 2.2, operator.countOf() works on any iterable object:
> Python 2.2a2+ (#23, Sep 6 2001, 20:10:09) [MSC 32 bit (Intel)] on
> >>> import operator
> >>> operator.countOf((1,2,3,1,2,3,2,2,2), 2)
Does it have operator.indexOf ()? Code would be nearly same.
More information about the Python-list