[New-bugs-announce] [issue12163] str.count

py.user report at bugs.python.org
Tue May 24 04:10:26 CEST 2011

New submission from py.user <port139 at yandex.ru>:

specification says
str.count(sub[, start[, end]])

    Return the number of non-overlapping occurrences of substring sub in the range [start, end]. Optional arguments start and end are interpreted as in slice notation.

>>> ''.count('', 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

messages: 136713
nosy: py.user
priority: normal
severity: normal
status: open
title: str.count
type: behavior
versions: Python 2.7, Python 3.1

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list