[issue12170] Bytes.index() and bytes.count() should accept byte ints

Max report at bugs.python.org
Wed May 25 20:34:54 CEST 2011


Max <max at alleged.net> added the comment:

Fair enough.

I think it would make sense for the string methods to also accept single ints where possible as well:

For haystack and needles both strings:
[haystack.find(n) for n in needles]

For both bytes, it's a bit contortionist:
[haystack.find(needles[i:i+1]) for i in range(len(needles))]

One ends up doing a lot of the [i:i+1] bending when using bytes functions.

----------
type: behavior -> 
versions:  -Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12170>
_______________________________________


More information about the Python-bugs-list mailing list