(self, value, start=None, stop=None)
T.index(value, [start, [stop]]) -> integer -- return first index of value.
           Raises ValueError if the value is not present.
T.index(value, [start, [stop]]) -> integer -- return first index of value.
           Raises ValueError if the value is not present.
T . index ( value [ start [ stop ]] ) - > integer -- return first index of value . Raises ValueError if the value is not present .
def index(self, value, start=None, stop=None):
        """T.index(value, [start, [stop]]) -> integer -- return first index of value.
           Raises ValueError if the value is not present."""
        # XXX: One would expect:
        #
        # return self.args.index(value, start, stop)
        #
        # here. Any trouble with that? Yes:
        #
        # >>> (1,).index(1, None, None)
        # Traceback (most recent call last):
        #   File "<stdin>", line 1, in <module>
        # TypeError: slice indices must be integers or None or have an __index__ method
        #
        # See: http://bugs.python.org/issue13340

        if start is None and stop is None:
            return self.args.index(value)
        elif stop is None:
            return self.args.index(value, start)
        else:
            return self.args.index(value, start, stop)
def index ( self , value , start = None , stop = None ) : # XXX: One would expect: # # return self.args.index(value, start, stop) # # here. Any trouble with that? Yes: # # >>> (1,).index(1, None, None) # Traceback (most recent call last): #   File "<stdin>", line 1, in <module> # TypeError: slice indices must be integers or None or have an __index__ method # # See: http://bugs.python.org/issue13340 if start is None and stop is None : return self . args . index ( value ) elif stop is None : return self . args . index ( value , start ) else : return self . args . index ( value , start , stop )